Difference between revisions of "Splitting $line string into words"
From thelinuxwiki
(Pushed from Themanclub.) |
Latest revision as of 21:17, 26 April 2013
astringvar='foo bar baz'
a=( $s )
echo ${a[0]} #word0 in string
echo ${a[1]} #word1 in string
foo
bar
if parsing a file...
cat $filename | while read line do echo "Processing new line" >/dev/tty for word in $line do echo $word done done