Setting variables for columns inside bash shell script -


my script when run

./program < "$1" | awk -f '!' '{print $3 $4, $5, $6, $7} 

returns values

900 200 30 400 5 51 31 2 3 4 

how set variable colummns each line have attempted

line=`./program < $1` in $line $line | awk -f '!' | read b c d e <<< "$(echo $i | cut -f4 -d:}' 

but no matter how can't seem values variables

you can use process substitution read these values each line of output awk:

while read -r b c d e;    echo "<$a><$b><$c><$d><$e>" done < <(./program < "$1" | awk -f '!' '{print $3 $4, $5, $6, $7}') 

in fact since awk printing columns delimited ! can remove awk completely:

while ifs='!' read -r b c d e;    echo "<$a><$b><$c><$d><$e>" done < <(./program < "$1") 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -