Thursday 15 May 2014

scripting - printing variable inside awk -


In this script, I have to type the variable $ file , $ f for the file, $ command and sum / nr (all in one line)

  #! / Bin / bash Pmb_mpi Tau XHTML MPI_Tile_O in fftw; 2.54 In the 1.60 800 do for the F, if [$ {F} = 2.54] then order in the order; Do # echo $ {file} _ $ {f} _ $ {order} _v1.xls & gt; & Gt; P-State Summary XLS awk '{sum = = $ 2} END {print $ {file} _ $ {f} _ $ {order} _v1.xls, sum / nr}' $ {file} _ $ {f} _ $ {order} _v1.xls & gt; & Gt; P-State Summary. Excel Seconds done # Alo $ {file} _ $ {F} _v1.xls & gt; & Gt; P-State - Summary. XLS awk '{sum = = 2} END {print $ {file} _ $ {f} _v1.xls, sum / nr}' $ {file} _ $ {F} _v1.xls> and gt; P-State Summary Xls FINED  

Do any of you help me with this?

You can:

  echo -n "$ {File} _ $ {f} _ $ {order} _v1.xls "& gt; & Gt; P-State- Summary .xls # or printf "$ {file} _ $ {F} _ $ {order} _v1.xls" & gt; & Gt; P-State - Summary. XLS advocate '{sum = = $ 2} END {print amount / NR}' "$ {file} _ $ {f} _ $ {order} _v1.xls" | T "$ {file} _ $ {f} _avrg.xls" & gt; & Gt; P-State - Summary: Without using "code \" without using \ "code \ echo -n  or  printf   

Will give new line so that the output of the command awk is on the same line. I have added a position as a separator, but you can use anything.

Using tee , you can write your output in different files and only one Awk per input (command) file.


No comments:

Post a Comment