text manipulation - bash: add column every n seconds -


i got output that:

0.000 0.002 0.000 0.002 0.000 0.026 ===== 0.026 

note, how last line (0.026) endtime of phases before. repeat command every n seconds , want next output written next column like:

0.000   0.000 0.002   0.001 0.000   0.000 0.002   0.001 0.000   0.000 0.026   0.027 =====   ===== 0.026   0.028 

i know sed -i solve problem can't work. since important have exact same timestamp on value cant execute command followed next 1 , write results place.

the command gives me these values is:

curl -w '\nlookup time:\t%{time_namelookup}\nconnect time:\t%{time_connect}\nprexfer time:\t%{time_pretransfer}\nstartxfer time:\t%{time_starttransfer}\n\ntotal time:\t%{time_total}\n' -o /dev/null -s http://linux.com/ 

using paste , command substitution can add new column side side previous output stored in file:

paste -d '\t' prevfile.out <(                                                                         curl -w '\nlookup time:\t%{time_namelookup}\nconnect time:\t%{time_connect}\nprexfer time:\t%{time_pretransfer}\nstartxfer time:\t%{time_starttransfer}\n=====================\ntotal time:\t%{time_total}\n' -o /dev/null -s http://linux.com/ ) 

this generate output:

lookup time:    0.005   lookup time:    1.528 connect time:   0.387   connect time:   1.788 prexfer time:   0.387   prexfer time:   1.788 startxfer time: 0.797   startxfer time: 2.059 =====================   ===================== total time: 0.797   total time: 2.059 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -