Sponsored Content
Top Forums Shell Programming and Scripting Find String and add to next column Post 302783061 by attila on Wednesday 20th of March 2013 12:11:35 AM
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
....
....

 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
unbound-streamtcp(1)						      unbound						      unbound-streamtcp(1)

NAME
unbound-streamtcp - unbound DNS lookup utility SYNOPSIS
unbound-streamtcp [-unsh] [-f ipaddr[@port]] name type class DESCRIPTION
unbound-streamtcp sends a DNS Query of the given type and class for the given name to the DNS server over TCP and displays the response. If the server to query is not given using the -f option then localhost (127.0.0.1) is used. More queries can be given on one commandline, they are resolved in sequence. The available options are: name This name is resolved (looked up in the DNS). type Specify the type of data to lookup. class Specify the class to lookup for. -u Use UDP instead of TCP. No retries are attempted. -n Do not wait for the answer. -s Use SSL. -h Print program usage. -f ipaddr[@port] Specify the server to send the queries to. If not specified localhost (127.0.0.1) is used. EXAMPLES
Some examples of use. $ unbound-streamtcp www.example.com A IN $ unbound-streamtcp -f 192.168.1.1 www.example.com SOA IN $ unbound-streamtcp -f 192.168.1.1@1234 153.1.168.192.in-addr.arpa. PTR IN EXIT CODE
The unbound-streamtcp program exits with status code 1 on error, 0 on no error. AUTHOR
This manual page was written by Tomas Hozza <thozza@redhat.com>. NLnet Labs Mar 21, 2013 unbound-streamtcp(1)
All times are GMT -4. The time now is 01:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy