AWK printing bash variable more than once -


i'm trying utilize awk 1 liner uses bash variable. problem being printed more once or giving out error. bash variable looks (without echo line):

echo "$time" 49.80 63.4 61 60.4 61 

the awk line i'm trying use this:

awk -v time="$time" -f, '{print $1,$2,$3,$4,$5=time}' file 

the output this:

santaclara 6/7/2015 d 4 49.80 63.4 61 60.4 61 santaclara 5/29/2015 d 5 49.80 63.4 61 60.4 61 santaclara 5/21/2015 d 5 49.80 63.4 61 60.4 61 santaclara 4/29/2015 d 5 49.80 63.4 61 60.4 61 santaclara 4/22/2015 d 5 49.80 63.4 61 60.4 61 

and i'm looking this:

santaclara 6/7/2015 d 4 49.80 santaclara 5/29/2015 d 5 63.40 santaclara 5/21/2015 d 5 61 santaclara 4/29/2015 d 5 60.4 santaclara 4/22/2015 d 5 61 

i've several variations on awk line , have gotten errors. doing wrong?

use paste instead:

$ paste file <(echo "$time") 

use -d switch if want specific delimiter (tab default).


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

php - Find a regex to take part of Email -

javascript - Function overwritting -