ckim@ckim-ubuntu:~/test$ cat tt
#define a b
#define c d
ckim@ckim-ubuntu:~/test$ for i in `cat tt`; do echo $i; done
#define
a
b
#define
c
d
The $i variable is taking every single word seperated by space or enter. How can I make $i represent each line from the cat
command? Either using for or while is ok for me and this is bash. Thank you!
ADD : I can iterate through the line by while read line; do echo $line; done < tt
but I want to do something for each line, and if I pass this output to a for loop, it's all separated to each word.