EvilMarshmallow
April 25th, 2008, 02:56 PM
Hey all,
I'm working on a bash script that reads data from a file using cut. I have the whole thing working just like I want, except that my while loop never terminates! Apparently I don't know what to compare it to if my 'cut' statement exceeds its available data. If I do
echo `cut -s -d, -f 7 file`
and my file only has 6 fields, I get a blank space. What can I compare to the output of cut in this case, so that when it no longer has data (my field counter exceeds the number of available fields), the loop will terminate?
I'm working on a bash script that reads data from a file using cut. I have the whole thing working just like I want, except that my while loop never terminates! Apparently I don't know what to compare it to if my 'cut' statement exceeds its available data. If I do
echo `cut -s -d, -f 7 file`
and my file only has 6 fields, I get a blank space. What can I compare to the output of cut in this case, so that when it no longer has data (my field counter exceeds the number of available fields), the loop will terminate?