bash - AWK read file, operate on several columns of certain lines and print all the file with the change performed -


I want to make some numerical changes in the file 'test' as I did not do it with 'sed' I tried to do this with 'awk' in this case, I want to multiply numbers by a certain number in the third line. Is described in the file test:

  xxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyy 0.08 0.11 0.14 0.19 0.24 Fixed zzzzzzzzzzzzzzzzz   

To do this, I have the following script 'file .awk ':

  printf start {} {/0k08/ "% K2f% K2f% K2f% K2f% K2f% S", $ L * var, $ 2 * Up, $ 3 *, $ 4 *, $ 5 *, $ 6;} {Print;} End {}   

Then I type in the command line:

  awk -v var = 2 -f file.awk test   

the script was like I wrote blows on the line, but it replaces the line

  yxyxx 0.48 period 0.08 0.11 0.14 0.19 0.24 Fixed zzzzzzzzzzzzzzzzzzzzz   

I function read sub and I tried despite being about gsub, but I did not succeed in changing the place of the new line old line .

Any thoughts? Thanks!

"itemprop =" text ">

after you , move forward in the next line, otherwise the following block needs to be printed < / Code> statement will be executed. next Use this way:

  /0.08/ {printf "% .2f% .2f% .2f% .2f% .2f% s \ n" , $ 1 * Var, $ 2 * var, $ 3 * var, $ 4 * var, $ 5 * var, $ 6; Next}   

Biteedblu, awk no support for it is the perfect tool for this is not an appropriate way to achieve this because the operation of mathematics Sad is not.

Also keep in mind, there are several ways to achieve this goal. Check the jotting answer for an option.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -