View Single Post
Old Jun 27th, 2005, 9:40 AM   #5
bryanlharris
Newbie
 
Join Date: Jun 2005
Location: Texas
Posts: 3
Rep Power: 0 bryanlharris is on a distinguished road
Thanks jim mcnamara for the great response. I think I will start using that read statement from now on. When running the for loop with IFS="\n" I do in fact get really strange results.

#!/bin/bash

while read record
do
echo "$record"
done < file

IFS="\n"

for i in `cat file`
do
echo "$i"
done
IFS=" "

My results look really nice using read and really weird using for i in `echo file`....
now is the time for
all good men to come
to the aid of their
countrymen.

ow is the time for
all good me
 to come
to the aid of their
cou
tryme
bryanlharris is offline   Reply With Quote