Bash loop delimiter
Posted by valqk on
Setting
IFS=\n
at your bash prompt will set the delimiter a for loop uses to a newline.
You can do:
OLDIFS=$IFS;
IFS="--a--";
for i in `cat $somefile`;
do
echo $i;
done
IFS=OLDIFS;
IFS=\n
at your bash prompt will set the delimiter a for loop uses to a newline.
You can do:
OLDIFS=$IFS;
IFS="--a--";
for i in `cat $somefile`;
do
echo $i;
done
IFS=OLDIFS;