scripting - Stdin and argument into shell script -


how pass argument stdin program using shell script?

if have data, how select numbered columns , input program "./calculate < data" stdin?

data:

ajk:1,2,3,4 bcd:8,9,3,1 

one sort of clunky way:

./calculate < awk -f '[:, ]' '{print $2, $3, $4, $5}' data 

your script can use loop reads stdin default:

while read v1 v2 v3 v4 # stuff 4 variables here done 

you can directly parse input inside loop. leave else post. since did not indicate shell - bash, ksh ....


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 -