Index

Subject : LUG: Bash Help

From : John Nance <jjnance@ncsu.[redacted]>

Date : Wed, 02 Mar 2011 13:45:02 -0500


Hey LUG,

I've accidently recorded a long data file that's only one line. I'd
like to break this line into a manageable data file that has a new
line each time the string "Alt" is encountered in the original file.
This is what I've got so far based on googling, but it's still
returning a blank "new.txt" file. I've got very little experience
using bash. Ideas?

#!/bin/bash

while read myline; do
lin = "$(echo $myline | cut -dAlt)"
echo lin >> /home/jamie/Downloads/new.txt
done < /home/jamie/Downloads/LOG6.txt

exit

I'll be hanging out in the IRC #ncsulug for the next bit if anyone has
quick questions or responses.

Thanks,
Jamie Nance


Replies :