Find String and add to next column


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find String and add to next column
# 1  
Old 03-20-2013
Find String and add to next column

Dear All,

I have file input

input01.txt
Code:
14193    40    153
14208    40    168
14283    45    243
14298    40    258
14313    41    273
14328    44    288
...
...

input02.txt
Code:
 499815.5   9886300.0     14208     94.2   1957.1   
  499815.5   9886300.0     14208    314.2   2101.0   
  499815.5   9886300.0     14208    397.9   2186.7   
  499815.5   9886300.0     14208    523.5   2288.1   
  499815.5   9886300.0     14208    693.4   2460.6   
  499815.5   9886300.0     14208    901.5   2686.8  
  499815.5   9886300.0     14208    996.1   2774.7   
  499815.5   9886300.0     14208   1457.0   3236.3  
  499815.5   9886300.0     14208   2038.9   3928.2   
  499815.5   9886300.0     14208   4090.6   5390.1  
  499815.5   9886300.0     14208   5974.9   6796.7   
  499845.1   9888493.0     14313     49.9   1895.6   
  499845.1   9888493.0     14313    304.6   2083.2   
  499845.1   9888493.0     14313    540.3   2332.2   
  499845.1   9888493.0     14313    746.5   2536.0  
  499845.1   9888493.0     14313    901.5   2686.8   
  499845.1   9888493.0     14313    996.1   2774.7  
  499845.1   9888493.0     14313   1457.0   3236.3   
  499845.1   9888493.0     14313   2208.3   3984.9   
  499845.1   9888493.0     14313   4090.6   5390.1   
  499845.1   9888493.0     14313   5974.9   6796.7   
....
....

Algoritm: Find 3rd column from input02.txt that match with 1st column from input01.txt, then print 2nd & 3rd column from input01.txt as 6th & 7th column.

output.txt

Code:
  499815.5   9886300.0     14208     94.2   1957.1   40   153
  499815.5   9886300.0     14208    314.2   2101.0   40   153
  499815.5   9886300.0     14208    397.9   2186.7   40   153
  499815.5   9886300.0     14208    523.5   2288.1   40   153
  499815.5   9886300.0     14208    693.4   2460.6   40   153
  499815.5   9886300.0     14208    901.5   2686.8   40   153
  499815.5   9886300.0     14208    996.1   2774.7   40   153
  499815.5   9886300.0     14208   1457.0   3236.3   40   153
  499815.5   9886300.0     14208   2038.9   3928.2   40   153
  499815.5   9886300.0     14208   4090.6   5390.1   40   153
  499815.5   9886300.0     14208   5974.9   6796.7   40   153
  499845.1   9888493.0     14313     49.9   1895.6   41    273
  499845.1   9888493.0     14313    304.6   2083.2   41    273
  499845.1   9888493.0     14313    540.3   2332.2   41    273
  499845.1   9888493.0     14313    746.5   2536.0   41    273
  499845.1   9888493.0     14313    901.5   2686.8   41    273
  499845.1   9888493.0     14313    996.1   2774.7   41    273
  499845.1   9888493.0     14313   1457.0   3236.3   41    273
  499845.1   9888493.0     14313   2208.3   3984.9   41    273
  499845.1   9888493.0     14313   4090.6   5390.1   41    273
  499845.1   9888493.0     14313   5974.9   6796.7   41    273
....
....

# 2  
Old 03-20-2013
Code:
join -1 1 -2 3 -o 2.1 2.2 2.3 2.4 2.5 1.2 1.3 input01.txt input02.txt

# 3  
Old 03-20-2013
Yoda, thans for the respon.

But I get some trouble with this lines..

input01_line11.txt
Code:
...
...
43158    120    318
43173    120    333
46533    130    93
46548    130    108
46563    130    123
46533    130    93
46548    130    108
93273    260    33
93288    260    48
93303    260    63
93318    260    78
93333    260    93
93348    260    108
93363    260    123
93378    260    138
93393    260    153
93408    260    168
93423    260    183
93438    260    198
93453    260    213
93468    260    228
93483    260    243
93498    260    258
96873    270    33
96888    270    48
96903    270    63
96918    270    78
...
...

input02_line11.txt

Code:
....
....
  499936.7   9885140.0     46533     49.9   1895.6  
  499936.7   9885140.0     46533    208.0   2019.3  
  499936.7   9885140.0     46533    468.1   2237.4  
  499936.7   9885140.0     46533    698.6   2479.4  
  499936.7   9885140.0     46533    816.5   2649.2  
  499936.7   9885140.0     46533   1000.6   2853.0  
  499936.7   9885140.0     46533   1497.7   3543.5  
  499936.7   9885140.0     46533   2399.8   4347.8  
  499936.7   9885140.0     46533   4090.6   5390.1  
  499936.7   9885140.0     46533   5974.9   6796.7  
  499947.9   9888003.0     93273     57.8   2019.5  
  499947.9   9888003.0     93273    202.1   2085.2  
  499947.9   9888003.0     93273    386.8   2227.3  
  499947.9   9888003.0     93273    578.9   2359.2  
  499947.9   9888003.0     93273    819.0   2623.0  
  499947.9   9888003.0     93273   1114.4   2957.8  
  499947.9   9888003.0     93273   1457.0   3236.3  
  499947.9   9888003.0     93273   2199.2   4071.5  
  499947.9   9888003.0     93273   2731.9   4434.1  
  499947.9   9888003.0     93273   4090.6   5390.1  
  499947.9   9888003.0     93273   5974.9   6796.7  
  499955.0   9884469.0     35748     76.3   1879.4  
  499955.0   9884469.0     35748    272.2   2193.0  
  499955.0   9884469.0     35748    471.5   2492.5  
  499955.0   9884469.0     35748    729.9   2891.7  
  499955.0   9884469.0     35748   1054.7   3268.9  
  499955.0   9884469.0     35748   1394.3   3501.8  
  499955.0   9884469.0     35748   1896.3   3878.9  
  499955.0   9884469.0     35748   2427.9   4156.2  
  499955.0   9884469.0     35748   2957.7   4486.0  
  499955.0   9884469.0     35748   4090.6   5390.1  
  499955.0   9884469.0     35748   5974.9   6796.7  
  499966.2   9887333.0     82488     49.9   1895.6  
  499966.2   9887333.0     82488    196.6   2014.3  
  499966.2   9887333.0     82488    389.3   2230.4  
  499966.2   9887333.0     82488    658.1   2502.0  
  499966.2   9887333.0     82488    901.5   2686.8  
  499966.2   9887333.0     82488   1162.6   2909.6  
  499966.2   9887333.0     82488   1538.2   3192.6  
  499966.2   9887333.0     82488   2138.4   3645.3  
  499966.2   9887333.0     82488   2830.6   4222.7  
  499966.2   9887333.0     82488   4090.6   5390.1  
  499966.2   9887333.0     82488   5974.9   6796.7  
  499973.3   9883799.0     24963     46.6   1854.3  
  499973.3   9883799.0     24963    261.1   2089.0  
  499973.3   9883799.0     24963    379.6   2254.3  
  499973.3   9883799.0     24963    624.8   2562.9  
  499973.3   9883799.0     24963   1032.0   3059.3  
  499973.3   9883799.0     24963   1323.8   3477.1  
  499973.3   9883799.0     24963   1700.8   4025.7  
  499973.3   9883799.0     24963   1944.3   4467.8  
  499973.3   9883799.0     24963   2294.6   4520.3  
  499973.3   9883799.0     24963   2857.4   4672.5  
  499973.3   9883799.0     24963   3365.6   4794.4  
  499973.3   9883799.0     24963   4297.3   5044.1  
  499973.3   9883799.0     24963   5929.5   5406.8  
  499984.5   9886662.0     71703     58.1   1838.1  
  499984.5   9886662.0     71703    190.9   1937.9  
  499984.5   9886662.0     71703    320.1   2004.4  
  499984.5   9886662.0     71703    478.9   2137.5  
  499984.5   9886662.0     71703    722.5   2359.4  
  499984.5   9886662.0     71703    996.1   2774.7  
  499984.5   9886662.0     71703   1228.9   3130.3  
  499984.5   9886662.0     71703   1468.2   3430.3  
  499984.5   9886662.0     71703   2204.6   4120.8  
  499984.5   9886662.0     71703   2676.0   4460.4  
  499984.5   9886662.0     71703   4090.6   5390.1  
  499984.5   9886662.0     71703   5974.9   6796.7  
  500002.9   9885991.0     60918     49.9   1895.6  
  500002.9   9885991.0     60918    233.2   2025.7  
  500002.9   9885991.0     60918    456.5   2231.4  
  500002.9   9885991.0     60918    613.9   2377.5  
  500002.9   9885991.0     60918    750.2   2502.0  
  500002.9   9885991.0     60918    960.1   2615.2  
  500002.9   9885991.0     60918   1620.3   3145.7  
  500002.9   9885991.0     60918   2088.7   3671.4  
  500002.9   9885991.0     60918   2692.6   4357.1  
  500002.9   9885991.0     60918   4090.6   5390.1  
  500002.9   9885991.0     60918   5974.9   6796.7  
  500014.1   9888855.0    107658     80.2   1749.3  
  500014.1   9888855.0    107658    294.3   1926.8  
  500014.1   9888855.0    107658    534.2   2071.0  
  500014.1   9888855.0    107658    777.9   2337.2  
  500014.1   9888855.0    107658   1014.1   2603.4  
  500014.1   9888855.0    107658   1139.6   2836.3  
  500014.1   9888855.0    107658   1298.3   3024.8  
  500014.1   9888855.0    107658   1512.4   3257.8  
  500014.1   9888855.0    107658   1896.3   3657.1  
  500014.1   9888855.0    107658   2738.6   4234.0  
  500014.1   9888855.0    107658   4090.6   5390.1  
  500014.1   9888855.0    107658   5974.9   6796.7  
  500021.2   9885321.0     50133     49.9   1895.6  
  500021.2   9885321.0     50133    235.2   2071.0  
  500021.2   9885321.0     50133    440.3   2237.4  
  500021.2   9885321.0     50133    621.3   2411.5  
  500021.2   9885321.0     50133   1007.9   2864.3  
  500021.2   9885321.0     50133   1475.6   3441.6  
  500021.2   9885321.0     50133   2003.4   4078.5  
  500021.2   9885321.0     50133   2553.4   4477.8  
  500021.2   9885321.0     50133   4090.6   5390.1  
  500021.2   9885321.0     50133   5974.9   6796.7  
  500032.4   9888184.0     96873     94.7   2071.9  
  500032.4   9888184.0     96873    260.4   2139.8  
  500032.4   9888184.0     96873    551.3   2354.9  
  500032.4   9888184.0     96873    960.1   2728.4  
  500032.4   9888184.0     96873   1147.7   2836.0  
  500032.4   9888184.0     96873   1479.6   3263.9  
  500032.4   9888184.0     96873   1685.5   3509.5  
  500032.4   9888184.0     96873   1982.4   3830.7  
  500032.4   9888184.0     96873   2515.5   4304.7  
  500032.4   9888184.0     96873   4090.6   5390.1  
  500032.4   9888184.0     96873   5974.9   6796.7 
  500039.5   9884650.0     39348     61.6   1958.7  
  500039.5   9884650.0     39348    271.5   2128.5  
  500039.5   9884650.0     39348    482.9   2288.1  
  500039.5   9884650.0     39348    804.2   2562.1  
  500039.5   9884650.0     39348   1482.9   3102.0  
  500039.5   9884650.0     39348   1896.3   3413.0  
  500039.5   9884650.0     39348   2340.9   3917.0  
  500039.5   9884650.0     39348   2834.3   4313.2  
  500039.5   9884650.0     39348   4090.6   5390.1  
  500039.5   9884650.0     39348   5974.9   6796.7
  500304.3   9888058.0     96888     50.7   1771.5  
  500304.3   9888058.0     96888    190.9   1871.3  
  500304.3   9888058.0     96888    460.4   2093.2  
  500304.3   9888058.0     96888    785.2   2348.3  
  500304.3   9888058.0     96888   1195.0   2736.5  
  500304.3   9888058.0     96888   1593.6   3135.8  
  500304.3   9888058.0     96888   1948.0   3524.0  
  500304.3   9888058.0     96888   2374.0   3905.7  
  500304.3   9888058.0     96888   2768.0   4369.8  
  500304.3   9888058.0     96888   4090.6   5390.1  
  500304.3   9888058.0     96888   5974.9   6796.7  

....
....

Output.txt

Code:
...
...
499936.7 9885140.0 46533 49.9 1895.6 130 93
499936.7 9885140.0 46533 208.0 2019.3 130 93
499936.7 9885140.0 46533 468.1 2237.4 130 93
499936.7 9885140.0 46533 698.6 2479.4 130 93
499936.7 9885140.0 46533 816.5 2649.2 130 93
499936.7 9885140.0 46533 1000.6 2853.0 130 93
499936.7 9885140.0 46533 1497.7 3543.5 130 93
499936.7 9885140.0 46533 2399.8 4347.8 130 93
499936.7 9885140.0 46533 4090.6 5390.1 130 93
499936.7 9885140.0 46533 5974.9 6796.7 130 93
499947.9 9888003.0 93273 57.8 2019.5 260 33
499947.9 9888003.0 93273 202.1 2085.2 260 33
499947.9 9888003.0 93273 386.8 2227.3 260 33
499947.9 9888003.0 93273 578.9 2359.2 260 33
499947.9 9888003.0 93273 819.0 2623.0 260 33
499947.9 9888003.0 93273 1114.4 2957.8 260 33
499947.9 9888003.0 93273 1457.0 3236.3 260 33
499947.9 9888003.0 93273 2199.2 4071.5 260 33
499947.9 9888003.0 93273 2731.9 4434.1 260 33
499947.9 9888003.0 93273 4090.6 5390.1 260 33
499947.9 9888003.0 93273 5974.9 6796.7 260 33
500032.4 9888184.0 96873 94.7 2071.9 270 33
500032.4 9888184.0 96873 260.4 2139.8 270 33
500032.4 9888184.0 96873 551.3 2354.9 270 33
500032.4 9888184.0 96873 960.1 2728.4 270 33
500032.4 9888184.0 96873 1147.7 2836.0 270 33
500032.4 9888184.0 96873 1479.6 3263.9 270 33
500032.4 9888184.0 96873 1685.5 3509.5 270 33
500032.4 9888184.0 96873 1982.4 3830.7 270 33
500032.4 9888184.0 96873 2515.5 4304.7 270 33
500032.4 9888184.0 96873 4090.6 5390.1 270 33
500032.4 9888184.0 96873 5974.9 6796.7 270 33
500304.3 9888058.0 96888 50.7 1771.5 270 48
500304.3 9888058.0 96888 190.9 1871.3 270 48
500304.3 9888058.0 96888 460.4 2093.2 270 48
500304.3 9888058.0 96888 785.2 2348.3 270 48
500304.3 9888058.0 96888 1195.0 2736.5 270 48
500304.3 9888058.0 96888 1593.6 3135.8 270 48
500304.3 9888058.0 96888 1948.0 3524.0 270 48
500304.3 9888058.0 96888 2374.0 3905.7 270 48
500304.3 9888058.0 96888 2768.0 4369.8 270 48
500304.3 9888058.0 96888 4090.6 5390.1 270 48
500304.3 9888058.0 96888 5974.9 6796.7 270 48
...
...


Error: Cannot print line that not contain string

Output expected:

Code:
....
....

  499936.7   9885140.0     46533     49.9   1895.6 130 93
  499936.7   9885140.0     46533    208.0   2019.3 130 93
  499936.7   9885140.0     46533    468.1   2237.4 130 93
  499936.7   9885140.0     46533    698.6   2479.4 130 93
  499936.7   9885140.0     46533    816.5   2649.2 130 93
  499936.7   9885140.0     46533   1000.6   2853.0 130 93
  499936.7   9885140.0     46533   1497.7   3543.5 130 93
  499936.7   9885140.0     46533   2399.8   4347.8 130 93
  499936.7   9885140.0     46533   4090.6   5390.1 130 93
  499936.7   9885140.0     46533   5974.9   6796.7 130 93
  499947.9   9888003.0     93273     57.8   2019.5 260 33
  499947.9   9888003.0     93273    202.1   2085.2 260 33
  499947.9   9888003.0     93273    386.8   2227.3 260 33
  499947.9   9888003.0     93273    578.9   2359.2 260 33
  499947.9   9888003.0     93273    819.0   2623.0 260 33
  499947.9   9888003.0     93273   1114.4   2957.8 260 33
  499947.9   9888003.0     93273   1457.0   3236.3 260 33
  499947.9   9888003.0     93273   2199.2   4071.5 260 33
  499947.9   9888003.0     93273   2731.9   4434.1 260 33
  499947.9   9888003.0     93273   4090.6   5390.1 260 33
  499947.9   9888003.0     93273   5974.9   6796.7 260 33                       
  499955.0   9884469.0     35748     76.3   1879.4  
  499955.0   9884469.0     35748    272.2   2193.0  
  499955.0   9884469.0     35748    471.5   2492.5  
  499955.0   9884469.0     35748    729.9   2891.7  
  499955.0   9884469.0     35748   1054.7   3268.9  
  499955.0   9884469.0     35748   1394.3   3501.8  
  499955.0   9884469.0     35748   1896.3   3878.9  
  499955.0   9884469.0     35748   2427.9   4156.2  
  499955.0   9884469.0     35748   2957.7   4486.0  
  499955.0   9884469.0     35748   4090.6   5390.1  
  499955.0   9884469.0     35748   5974.9   6796.7  
  499966.2   9887333.0     82488     49.9   1895.6  
  499966.2   9887333.0     82488    196.6   2014.3  
  499966.2   9887333.0     82488    389.3   2230.4  
  499966.2   9887333.0     82488    658.1   2502.0  
  499966.2   9887333.0     82488    901.5   2686.8  
  499966.2   9887333.0     82488   1162.6   2909.6  
  499966.2   9887333.0     82488   1538.2   3192.6  
  499966.2   9887333.0     82488   2138.4   3645.3  
  499966.2   9887333.0     82488   2830.6   4222.7  
  499966.2   9887333.0     82488   4090.6   5390.1  
  499966.2   9887333.0     82488   5974.9   6796.7  
  499973.3   9883799.0     24963     46.6   1854.3  
  499973.3   9883799.0     24963    261.1   2089.0  
  499973.3   9883799.0     24963    379.6   2254.3  
  499973.3   9883799.0     24963    624.8   2562.9  
  499973.3   9883799.0     24963   1032.0   3059.3  
  499973.3   9883799.0     24963   1323.8   3477.1  
  499973.3   9883799.0     24963   1700.8   4025.7  
  499973.3   9883799.0     24963   1944.3   4467.8  
  499973.3   9883799.0     24963   2294.6   4520.3  
  499973.3   9883799.0     24963   2857.4   4672.5  
  499973.3   9883799.0     24963   3365.6   4794.4  
  499973.3   9883799.0     24963   4297.3   5044.1  
  499973.3   9883799.0     24963   5929.5   5406.8  
  499984.5   9886662.0     71703     58.1   1838.1  
  499984.5   9886662.0     71703    190.9   1937.9  
  499984.5   9886662.0     71703    320.1   2004.4  
  499984.5   9886662.0     71703    478.9   2137.5  
  499984.5   9886662.0     71703    722.5   2359.4  
  499984.5   9886662.0     71703    996.1   2774.7  
  499984.5   9886662.0     71703   1228.9   3130.3  
  499984.5   9886662.0     71703   1468.2   3430.3  
  499984.5   9886662.0     71703   2204.6   4120.8  
  499984.5   9886662.0     71703   2676.0   4460.4  
  499984.5   9886662.0     71703   4090.6   5390.1  
  499984.5   9886662.0     71703   5974.9   6796.7  
  500002.9   9885991.0     60918     49.9   1895.6  
  500002.9   9885991.0     60918    233.2   2025.7  
  500002.9   9885991.0     60918    456.5   2231.4  
  500002.9   9885991.0     60918    613.9   2377.5  
  500002.9   9885991.0     60918    750.2   2502.0  
  500002.9   9885991.0     60918    960.1   2615.2  
  500002.9   9885991.0     60918   1620.3   3145.7  
  500002.9   9885991.0     60918   2088.7   3671.4  
  500002.9   9885991.0     60918   2692.6   4357.1  
  500002.9   9885991.0     60918   4090.6   5390.1  
  500002.9   9885991.0     60918   5974.9   6796.7  
  500014.1   9888855.0    107658     80.2   1749.3  
  500014.1   9888855.0    107658    294.3   1926.8  
  500014.1   9888855.0    107658    534.2   2071.0  
  500014.1   9888855.0    107658    777.9   2337.2  
  500014.1   9888855.0    107658   1014.1   2603.4  
  500014.1   9888855.0    107658   1139.6   2836.3  
  500014.1   9888855.0    107658   1298.3   3024.8  
  500014.1   9888855.0    107658   1512.4   3257.8  
  500014.1   9888855.0    107658   1896.3   3657.1  
  500014.1   9888855.0    107658   2738.6   4234.0  
  500014.1   9888855.0    107658   4090.6   5390.1  
  500014.1   9888855.0    107658   5974.9   6796.7  
  500021.2   9885321.0     50133     49.9   1895.6  
  500021.2   9885321.0     50133    235.2   2071.0  
  500021.2   9885321.0     50133    440.3   2237.4  
  500021.2   9885321.0     50133    621.3   2411.5  
  500021.2   9885321.0     50133   1007.9   2864.3  
  500021.2   9885321.0     50133   1475.6   3441.6  
  500021.2   9885321.0     50133   2003.4   4078.5  
  500021.2   9885321.0     50133   2553.4   4477.8  
  500021.2   9885321.0     50133   4090.6   5390.1  
  500021.2   9885321.0     50133   5974.9   6796.7  
  500032.4   9888184.0     96873     94.7   2071.9 270 33
  500032.4   9888184.0     96873    260.4   2139.8 270 33
  500032.4   9888184.0     96873    551.3   2354.9 270 33
  500032.4   9888184.0     96873    960.1   2728.4 270 33
  500032.4   9888184.0     96873   1147.7   2836.0 270 33
  500032.4   9888184.0     96873   1479.6   3263.9 270 33
  500032.4   9888184.0     96873   1685.5   3509.5 270 33
  500032.4   9888184.0     96873   1982.4   3830.7 270 33
  500032.4   9888184.0     96873   2515.5   4304.7 270 33
  500032.4   9888184.0     96873   4090.6   5390.1 270 33
  500032.4   9888184.0     96873   5974.9   6796.7 270 33
  500039.5   9884650.0     39348     61.6   1958.7  
  500039.5   9884650.0     39348    271.5   2128.5  
  500039.5   9884650.0     39348    482.9   2288.1  
  500039.5   9884650.0     39348    804.2   2562.1  
  500039.5   9884650.0     39348   1482.9   3102.0  
  500039.5   9884650.0     39348   1896.3   3413.0  
  500039.5   9884650.0     39348   2340.9   3917.0  
  500039.5   9884650.0     39348   2834.3   4313.2  
  500039.5   9884650.0     39348   4090.6   5390.1  
  500039.5   9884650.0     39348   5974.9   6796.7
  500304.3   9888058.0     96888     50.7   1771.5 270 48
  500304.3   9888058.0     96888    190.9   1871.3 270 48
  500304.3   9888058.0     96888    460.4   2093.2 270 48
  500304.3   9888058.0     96888    785.2   2348.3 270 48
  500304.3   9888058.0     96888   1195.0   2736.5 270 48
  500304.3   9888058.0     96888   1593.6   3135.8 270 48
  500304.3   9888058.0     96888   1948.0   3524.0 270 48
  500304.3   9888058.0     96888   2374.0   3905.7 270 48
  500304.3   9888058.0     96888   2768.0   4369.8 270 48
  500304.3   9888058.0     96888   4090.6   5390.1 270 48
  500304.3   9888058.0     96888   5974.9   6796.7 270 48

....
....

Thanks for advance,
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to find string based on pattern and search for its corresponding rows in column

Experts, Need your support for this awk script. we have only one input file, all these column 1 and column 2 are in same file and have to do lookup for values in one file(column1 and column2) but output we need in another file Need to grep row whose string contains 9K from column 1. When found... (6 Replies)
Discussion started by: as7951
6 Replies

2. Shell Programming and Scripting

awk to find maximum and minimum from column and store in other column

Need your support for below. Please help to get required output If column 5 is INV then only consider column1 and take out duplicates/identical rows/values from column1 and then put minimum value of column6 in column7 and put maximum value in column 8 and then need to do subtract values of... (7 Replies)
Discussion started by: as7951
7 Replies

3. Shell Programming and Scripting

awk find which column contains string

i want to search columns in a variable and any column contains a particular string, i want to print the value of that column $ echo "${USEDMEMORY}" memTotalReal=3925908 memAvailReal=1109812 memBuffer=242676 memCached=641628 $ $ echo "${USEDMEMORY}" | awk '/memAvailReal/' so what im trying... (6 Replies)
Discussion started by: SkySmart
6 Replies

4. Shell Programming and Scripting

Perl find and add to column

Hi, Could you help me with script in perl ;A1;AAA;%/A/B;70;75;-; ;A1;AAA;%/A/C;70;75;-; ;A1;BBB;%/A/G;70;75;-; ;A1;BBB;%/A;70;75;-;I would like to find line with '%/A' and put in that line in column 5 and 6 some other value ex: 90 and 99 example output: ;A1;AAA;%/A/B;70;75;-;... (5 Replies)
Discussion started by: vikus
5 Replies

5. Shell Programming and Scripting

Find column and add numbering

Hi Masters, Kindly need your help to format this data... IMPORT_HORIZON_HEADER 0 0 35 SURFACE_DATA_FORMAT XYZ- COLOR_FORMAT RGB SURFACE EB_S1_S2_Fault1 700 3 475370.187500 3672355.250000 1513.770386 475544.281250 3672530.250000 2255.540039 (4 Replies)
Discussion started by: ipatah
4 Replies

6. Shell Programming and Scripting

Find lines with matching column 1 value, retain only the one with highest value in column 2

I have a file like: I would like to find lines lines with duplicate values in column 1, and retain only one based on two conditions: 1) keep line with highest value in column 3, 2) if column 3 values are equal, retain the line with the highest value in column 4. Desired output: I was able to... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

7. Shell Programming and Scripting

Need to add letters to a column and add in a new column subtracting from another column

So I have this input 1 10327 rs112750067 T C . PASS DP=65;AF=0.208;CB=BC,NCBI 1 10469 rs117577454 C G . PASS DP=2055;AF=0.020;CB=UM,BC,NCBI 1 10492 rs55998931 C T . PASS DP=231;AF=0.167;CB=BC,NCBI 1 10583 rs58108140 G A ... (3 Replies)
Discussion started by: kellywilliams
3 Replies

8. Shell Programming and Scripting

find expression with awk in only one column, and if it fits, print whole column

Hi. How do I find an expression with awk in only one column, and if it fits, then print that whole column. 1 apple oranges 2 bannanas pears 3 cats dogs 4 hesaid shesaid echo "which number:" read NUMBER (user inputs number 2 for this example) awk " /$NUMBER/ {field to search is field... (2 Replies)
Discussion started by: glev2005
2 Replies

9. UNIX for Dummies Questions & Answers

find the string in the 55th column [awk]

hi people, i need a help!!!! i'm trying use a awk command, but i dont have success!.. i need find the string 'FL' in 55th column in a length file of 2.4Gb!!! Attempts: awk -F"\t" ' { if ($55 ~ /^F/) print $0} ' FILE awk -F"\t" ' { if ($55 ~ /FL/) print $0} ' FILE awk -F"\t" ' { if... (7 Replies)
Discussion started by: gandarez
7 Replies

10. Solaris

find the string in the 55th column [awk]

hi people, i need a help!!!! i'm trying use a awk command, but i dont have success!.. i need find the string 'FL' in 55th column in a length file of 2.4Gb!!! Attempts: awk -F"\t" ' { if ($55 ~ /^F/) print $0} ' FILE awk -F"\t" ' { if ($55 ~ /FL/) print $0} ' FILE awk -F"\t" ' { if... (5 Replies)
Discussion started by: gandarez
5 Replies
Login or Register to Ask a Question