Re: Looping through lines with tabs of file with cat
yitzle wrote: > fileIn="blah" > for i in "$(cat $fileIn)" > do > echo $i > echo > done Check out http://wooledge.org/mywiki/BashFAQ#faq1 J.
Re: Looping through lines with tabs of file with cat
On 11/4/07, Mike Stroyan <[EMAIL PROTECTED]> wrote: > On Sun, Nov 04, 2007 at 07:42:21AM -0800, yitzle wrote: > > How do I loop through the lines of a file when the lines have a tab in them? > > When I quote the cat operator, it reads the entire file at once. > > When I do not quote, each tab seperated item is treated as a new item. > > How do I make it seperate items by newline only? > > -- CODE -- > > fileIn="blah" > > for i in "$(cat $fileIn)" > > do > > echo $i > > echo > > done > > Don't use cat. Read the contents of the file directly with "read". > > fileIn="blah" > while read i > do > echo "$i" > echo > done < "$fileIn" Thanks!
Re: Looping through lines with tabs of file with cat
On Sun, Nov 04, 2007 at 07:42:21AM -0800, yitzle wrote: > How do I loop through the lines of a file when the lines have a tab in them? > When I quote the cat operator, it reads the entire file at once. > When I do not quote, each tab seperated item is treated as a new item. > How do I make it seperate items by newline only? > -- CODE -- > fileIn="blah" > for i in "$(cat $fileIn)" > do > echo $i > echo > done Don't use cat. Read the contents of the file directly with "read". fileIn="blah" while read i do echo "$i" echo done < "$fileIn" -- Mike Stroyan <[EMAIL PROTECTED]>
Looping through lines with tabs of file with cat
How do I loop through the lines of a file when the lines have a tab in them? When I quote the cat operator, it reads the entire file at once. When I do not quote, each tab seperated item is treated as a new item. How do I make it seperate items by newline only? -- CODE -- fileIn="blah" for i in "$(cat $fileIn)" do echo $i echo done Thanks! -- View this message in context: http://www.nabble.com/Looping-through-lines-with-tabs-of-file-with-cat-tf4747321.html#a13574521 Sent from the Gnu - Bash mailing list archive at Nabble.com.