Trying to match $1 of genematch.txt with $11 of design.txt, if there is a match then in the first row of the match $1 is copied to column 1,
row 2 of design.txt, $2 is copied to column 2, row 2 of design.txt, $3 is copied to column 3, row 2 of design.txt, $4 is copied to column 4, row 2 of
design.txt, and $5 is copied to column 5, row 2 of design.txt.
For example, SKI is the first name in genematch.txt and that matches row 1595 in design.txt
so in column 1, row 1595 $1, in column 2 row 1595 $2, in column 3 row 1595 $3, in column 4 row 1595 $4, in column 5 row 1595 $5.
The input and output is tab-delimited.
Thank you .
Moderator's Comments:
As I said before: CODE tags are needed around sample input, output, and code; not around descriptive text explaining what the tagged segments contain.
Sorry, I can't figure out what you request. What is "row 2 of design.txt" when the match is in row 1595, and you print every single line according to your code snippet?
BTW, the OFS assignment must come before the input file that produces output, and the <TAB> char can be constructed with "\t" in some awks.
I apologize, only the row in which the match is found does the new text need to be copied.
So in the example, SKI is the first name in genematch.txt and that matches row 1595 in design.txt so in column 1, row 1595 $1, in column 2 row 1595 $2, in column 3 row 1595 $3, in column 4 row 1595 $4, in column 5 row 1595 $5.
The additional columns in design.txt that have information in them just need to be copied. I am basically trying to add text to fields in which there is a match. Thank you .
I am trying to change the number in bold to 2400
01,000300032,193631306,190619,0640,1,80,,2/
02,193631306,000300032,1,190618,0640,CAD,2/
I'm not sure if sed or awk is the answer. I was going to use sed and do a character count up to that point, but that column directly before 0640 might... (8 Replies)
This is a question that is related to one I had last August when I was trying to sort/merge two files by millsecond time column (in this case column 6).
The script (below) that helped me last august by RudiC solved the puzzle of sorting/merging two files by time, except it gets lost when the... (0 Replies)
I am trying to use awk to match the NM_ in file with $1 of id which is tab-delimited. The NM_ will always be in the line of file that starts with > and be after the second _. When there is a match between each NM_ and id, then the value of $2 in id is substituted or used to update the NM_. Each NM_... (3 Replies)
My original files are like this below and I distinguish them from the AP_ID (file1 has 572 and file2 has 544). Also, the header on file1 has “G_” pre-pended. NOTE: these are only snippets of very large files and much of the data is not present here.
Original File 1:
... (36 Replies)
this is the requirement
list.txt
table1
table2
table3
testfile.txt
name#place#data#select * from table1
name2#place2#data2#select * from table 10 innerjoin table3
name2#place2#data2#select * from table 10
output
name place table1
name2 place table3
i tried using awk (7 Replies)
Hi
I have output of a command saved in a file..
# cat /file.txt
System: cu=4 ent=0.1 mode=on
cu min u s w i
0 500 0.1 0.3 0.5 0.1
1 200 0.5 0.2 0.3 0.0
By using ksh, what I need to do is, I need to grep the u,s,w and i... (5 Replies)
Hi,
I want to delete rows that have 0 at column 4.
The file looks like this:
chr01 13 61 2
chr01 65 153 0
chr01 157 309 1
chr01 313 309 0
chr01 317 469 1
chr01 473 557 0
I want to delete all rows with a 0 at column 4
chr01 13 61 2
chr01 157 309 1
chr01 ... (3 Replies)
Hi,
I am new to UNIX. Can some one help me to solve the below.
I have a requirement to to identify the specific fields in row and also some part of the field.
In my file I have a record as
sundra;10.44.48.65;10thstreet TCP packet out of state: First packet isn't SYN;telno:... (3 Replies)
Hello, I am using awk to process a file, and need to return a row that meets specific criteria.
awk 'BEGIN{sets variables}
{processes file, updates variables}
END{need to print a row that meets the criteria in one of the variables}
I have tried code in the END block like {print NR==var}... (1 Reply)
Hi,
I am having trouble converting a text file. I have been working for this whole day now, still i couldn't make it.
Here is how the text file looks:
_______________________________________________________
DEVICE STATUS INFORMATION FOR LOCATION 1:
OPER STATES: Disabled E:Enabled ... (5 Replies)