kvdbreem
October 28th, 2007, 05:03 AM
I have a question
Let's say we want to go through a file line-by-line
How would I do this? I've tried it with cat but that only works if the lines have no spaces. Otherwise, a file whose lines are
hello how are you
i am fine
when processed as follows:
#!/bin/bash
for i in `cat file`
do
echo ${i}
done
will come out as
hello
how
are
you
i
am
fine
Let's say we want to go through a file line-by-line
How would I do this? I've tried it with cat but that only works if the lines have no spaces. Otherwise, a file whose lines are
hello how are you
i am fine
when processed as follows:
#!/bin/bash
for i in `cat file`
do
echo ${i}
done
will come out as
hello
how
are
you
i
am
fine