thunderkid
Technical User
I want to thanks the many out there that give so much to helping others learning about “awking”. Your help has really made a difference in my being able to tackle data extractions and formatting.
I am extracting data from a text file. The text file has thousands of line and up to 25 columns. What the script searches on for column 1 I want to bring in from a second file. Here is the script that I am now using:
if( $1== “<search string>” && $2 ~ /abc/)
print $1, $2, $4
}
input file:
12345678 abcde 567klm 6789
45678123 abcde 5694kn 5678
12345678 abcde 567klm 4589
22345678 abcde 786klm 3426
22345678 abcde 567klm 4573
45678123 abcde 5694kn 5678
2nd file (for col 1 search string):
12345678
22345678
desired output:
12345678 abcde 6789
12345678 abcde 4589
22345678 abcde 3426
22345678 abcde 4573
The values for the search on col 1 has quantities up to 30. I want to read in these values so that I do not have to build the script 30 times. Thanks.
I am extracting data from a text file. The text file has thousands of line and up to 25 columns. What the script searches on for column 1 I want to bring in from a second file. Here is the script that I am now using:
if( $1== “<search string>” && $2 ~ /abc/)
print $1, $2, $4
}
input file:
12345678 abcde 567klm 6789
45678123 abcde 5694kn 5678
12345678 abcde 567klm 4589
22345678 abcde 786klm 3426
22345678 abcde 567klm 4573
45678123 abcde 5694kn 5678
2nd file (for col 1 search string):
12345678
22345678
desired output:
12345678 abcde 6789
12345678 abcde 4589
22345678 abcde 3426
22345678 abcde 4573
The values for the search on col 1 has quantities up to 30. I want to read in these values so that I do not have to build the script 30 times. Thanks.