unix - Renumber everything that is in a specific column -


1) how renumber second column numbered 33 through 64 instead of 1 through 32?

2) how renumber 5th column add +5 every number shown? i.e. first 21 rows have 6 in fifth column. next 10 rows have 7 in fifth column.

atom      1  n   phe     1    -475.892 131.360  18.903  1.00  0.00      prt atom      2  ht1 phe     1    -474.916 131.490  19.239  1.00  0.00      prt  atom      3  ht2 phe     1    -476.183 130.447  19.307  1.00  0.00      prt  atom      4  ht3 phe     1    -475.832 131.151  17.886  1.00  0.00      prt  atom      5  ca  phe     1    -476.789 132.490  19.345  1.00  0.00      prt  atom      6  ha  phe     1    -476.569 132.728  20.375  1.00  0.00      prt  atom      7  cb  phe     1    -478.274 131.952  19.117  1.00  0.00      prt  atom      8  hb1 phe     1    -478.456 131.739  18.042  1.00  0.00      prt  atom      9  hb2 phe     1    -478.286 131.075  19.799  1.00  0.00      prt  atom     10  cg  phe     1    -479.371 132.856  19.681  1.00  0.00      prt  atom     11  cd1 phe     1    -479.397 133.069  21.055  1.00  0.00      prt  atom     12  hd1 phe     1    -478.620 132.654  21.679  1.00  0.00      prt  atom     13  ce1 phe     1    -480.290 133.963  21.694  1.00  0.00      prt  atom     14  he1 phe     1    -480.124 134.160  22.743  1.00  0.00      prt  atom     15  cz  phe     1    -481.372 134.402  20.921  1.00  0.00      prt  atom     16  hz  phe     1    -482.102 134.958  21.489  1.00  0.00      prt  atom     17  cd2 phe     1    -480.448 133.314  18.973  1.00  0.00      prt  atom     18  hd2 phe     1    -480.491 132.982  17.947  1.00  0.00      prt  atom     19  ce2 phe     1    -481.482 134.041  19.531  1.00  0.00      prt  atom     20  he2 phe     1    -482.274 134.377  18.879  1.00  0.00      prt  atom     21  c   phe     1    -476.621 133.775  18.553  1.00  0.00      prt  atom     22  o   phe     1    -475.878 133.873  17.601  1.00  0.00      prt  atom     23  n   ala     2    -477.290 134.879  18.946  1.00  0.00      prt  atom     24  hn  ala     2    -477.881 134.828  19.748  1.00  0.00      prt  atom     25  ca  ala     2    -477.351 136.159  18.388  1.00  0.00      prt  atom     26  ha  ala     2    -477.908 136.596  19.203  1.00  0.00      prt  atom     27  cb  ala     2    -478.334 136.235  17.240  1.00  0.00      prt  atom     28  hb1 ala     2    -479.283 135.711  17.486  1.00  0.00      prt  atom     29  hb2 ala     2    -478.622 137.304  17.146  1.00  0.00      prt  atom     30  hb3 ala     2    -477.977 135.831  16.269  1.00  0.00      prt  atom     31  c   ala     2    -476.110 136.902  18.239  1.00  0.00      prt  atom     32  o   ala     2    -475.529 137.197  19.296  1.00  0.00      prt 

use following awk action:

{     $2 += 32;     $5 += 5;     print; } 

you may need adjust field separator , output format.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -