I have a text file that contains multiple lines of text.
When i read the text file in a shell script, line by line, then the line appears to contain the individual words, separated by spaces
I don't want the individual words, but I want the whole line in the $myline variable...
How can I do this ?
Note : The number of words per line is variable
--------------------------------------------------------------------
How can I believe in God when just last week I got my tongue caught in the roller of an electric typewriter?
---------------------------------------------------------------------
---------------------------------------------------------------
When i read the text file in a shell script, line by line, then the line appears to contain the individual words, separated by spaces
Code:
myfile.txt
-----------
John Doe 23 Street 1
Jane Doe 24 My Street Address 2
for myline in `cat myfile.txt`
do
echo $myline
done
Output :
--------
John
Doe
23
Street
1
Jane
Doe
24
My
Street
Address
2
I don't want the individual words, but I want the whole line in the $myline variable...
How can I do this ?
Note : The number of words per line is variable
--------------------------------------------------------------------
How can I believe in God when just last week I got my tongue caught in the roller of an electric typewriter?
---------------------------------------------------------------------
---------------------------------------------------------------