[PLUG] Bash script w/external data
David Fleck
david.fleck at mchsi.com
Sun Oct 30 14:17:04 UTC 2005
On Sat, 29 Oct 2005, Paul Heinlein wrote:
>> pdxfiles wrote:
>>> Is there a way for bash to pull the data line by line, or is another tool
>>> needed? I couldn't seem to find anything that I could specify a line to
>>> read. I think I could scrape the rest of the script together if I just
>>> could find a way to read a specific line.
>>>
> 2. Reset $IFS to a newline character and do as Russ suggested:
>
> IFS=$(echo)
> for L in $(<source.txt); do echo $L; done
> unset IFS
This variation works on my version of bash:
IFS=,;while read varA varB varC; do echo "$varC $varB $varA"; done < source.txt
but it won't handle complex cases, like embedded commas within a field.
--
David Fleck
david.fleck at mchsi.com
More information about the PLUG
mailing list