Results 1 to 2 of 2
I need to read a text file line by line using bash. I have it working using the code below, but the problem is that when it won't read in ...
- 12-03-2009 #1Just Joined!
- Join Date
- Dec 2008
- Posts
- 11
Reading lines from text file in Bash
I need to read a text file line by line using bash. I have it working using the code below, but the problem is that when it won't read in the backslash character (\). These get excluded if I echo the contents in the script or write them to a different file. Does anyone know how to get the backslashes to stay?
Code:cat file.txt | while read line do echo "$line" done
- 12-03-2009 #2Just Joined!
- Join Date
- Dec 2008
- Posts
- 11
Got it. Had to use the -r option for my read command to get the raw input.


Reply With Quote