Sponsored Content
Top Forums Shell Programming and Scripting awk to update field using matching value in file1 and substring in field in file2 Post 302999355 by cmccabe on Sunday 18th of June 2017 07:38:09 AM
Old 06-18-2017
Sorry Neo, does the below help?

The NM_ value of $2 in file1, after splitting on the ., will match a substring NM_ in $12 (the majority of the time), or $9 (in some cases).
The substring that matches is extracted starting from the NM_ until the ; or break (if it is the last value, like in case 1 in the example).
The text in $7 of file2 determines the field to use/ extract from.... that is if $7=exonic, then use $12, but if $7 is not =exonic, then use $9.
The extracted value is used to update $14 from a . to the extracted value. Thank you very much Smilie.

Last edited by cmccabe; 06-18-2017 at 08:39 AM.. Reason: added details
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

print contents of file2 for matching pattern in file1 - AWK

File1 row is same as column 2 in file 2. Also file 2 will either start with A, B or C. And 3rd column in file 2 is always F2. When column 2 of file 2 matches file1 column, print all those rows into a separate file. Here is an example. file 1: 100 103 104 108 file 2: ... (6 Replies)
Discussion started by: i.scientist
6 Replies

2. Shell Programming and Scripting

Read Field from file1 and find and replace in file2

Hi All, I have file1 line below: $myName$|xxx Now I need to read the file1 and find for $myName$ in file2 and replace with xxx file1: $myName$|xxx file2: My name is $myName$ expected output in file2 after executing the script is below: my name is xxx Thanks, (8 Replies)
Discussion started by: gdevadas
8 Replies

3. Shell Programming and Scripting

AWK: Pattern match between 2 files, then compare a field in file1 as > or < field in file2

First, thanks for the help in previous posts... couldn't have gotten where I am now without it! So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following: If $1... (4 Replies)
Discussion started by: right_coaster
4 Replies

4. Shell Programming and Scripting

using field 2 in file2 to complete field 3 in file1

Hello, I was hoping someone could help me with this work related problem... basically what I want to do is the following: file2: 1 o 2 t 4 f 5 v 7 n 8 e 10 a file1: 1 : (8 Replies)
Discussion started by: smarones
8 Replies

5. UNIX for Dummies Questions & Answers

if matching strings in file1 and file2, add column from file1 to file2

I have very limited coding skills but I'm wondering if someone could help me with this. There are many threads about matching strings in two files, but I have no idea how to add a column from one file to another based on a matching string. I'm looking to match column1 in file1 to the number... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

6. Shell Programming and Scripting

Retreive the records from file2 by using the first field in file1

Hi Freinds, i have a file1 as below file1 1|ndmf|fdd|d3484|34874 2|jdehf|wru7|478|w489 3|dfkj|wej|484|49894 file2 contains lakhs of records and not in sorted order i want to retrive only the records from file2 by searcing the first field of file 1 i used grep ^1 file2... (4 Replies)
Discussion started by: i150371485
4 Replies

7. Shell Programming and Scripting

Replacing first field of file2 with the second filed of file1 for matching cases

Dear All, Need your help..:D I am not regular on shell scripts..:( I have 2 files.. Content of file1 cellRef 4};"4038_2_MTNL_KALAMBOLI" cellRef 1020};"4112_3_RAINBOW_BLDG" cellRef 134};"4049_2_TATA_HOSPITAL" cellRef 1003};"4242_3_HITESH_CONSTRUCTION" cellRef... (6 Replies)
Discussion started by: ailnilanjan
6 Replies

8. Shell Programming and Scripting

awk to search field2 in file2 using range of fields file1 and using match to another field in file1

I am trying to use awk to find all the $2 values in file2 which is ~30MB and tab-delimited, that are between $2 and $3 in file1 which is ~2GB and tab-delimited. I have just found out that I need to use $1 and $2 and $3 from file1 and $1 and $2of file2 must match $1 of file1 and be in the range... (6 Replies)
Discussion started by: cmccabe
6 Replies

9. Shell Programming and Scripting

awk to update field in file2 if not the same as file1

Trying to use awk to: update $2 in file2 with the $2 value in file1, if $1 in file1 matches $13 in file2, which is tab-delimeted. The $2values may already be the same so in that case nothing happens and the next line is processed. There are exactly 4,605 unique $13 values. Thank you :). ... (4 Replies)
Discussion started by: cmccabe
4 Replies

10. Shell Programming and Scripting

awk to look up values in File 2 from File 1, & printingNth field of File1 based value of File2 $2

I have two files which are the output of a multiple choice vocab test (60 separate questions) from 104 people (there are some missing responses) and the question list. I have the item list in one file (File1) Item,Stimulus,Choice1,Choice2,Choice3,Choice4,Correct... (5 Replies)
Discussion started by: samonl
5 Replies
ar86(1) 						      General Commands Manual							   ar86(1)

NAME
ar86 - Create, modify, and extract from archive file SYNOPSIS
ar86 operation archive [file...] ar86 positional-op member archive [file...] DESCRIPTION
The ar86 program is used to create, examine and modify archive files produced by the Dev86/ELKS toolchain. OPTIONS
The ar86 command requires that the operation to be performed on the archive be specified as the first option. If the operation is positional then the next option is the archive member marking the position. This is followed by the archive file name and any list of file names. Operations One of the following operations can be specified d delete the listed files from the archive. m move the named files. By default files are moved to the end of the archive unless a positional modifier is present. p print the contents of archive members to standard out. If a file list is included only those members are printed. If the v modifier is present each file's contents are preceeded by a new line, a line with the string member, a space character, the member name, and two following newlines. q quickly add the files to the end of the archive without checking to see if they already exist in the archive. This operation will ignore any positional modifiers. Creates the archive file if it does not exist. r replace archive members with the files listed. If the file name is not present in the archive it is added to the end of the archive (or to any explicitly specified position). Creates the archive file if it does not exist. t table; list the file names of archive members. If a file list is present only those files that are present in the archive are listed. The v modifier prints member attributes. x extract the named files from the archive into the current directory. If no files are specified all the archive members will be extracted. Modifiers The following modifiers may be used with the operations o original time stamps from the archive are preserved for extracted files when possible. s symbol update; this option may be used by itself to force an update to the symbol definition section of the archive (the __.SYMDEF member). If any files are specified they will be replaced as if the r operation had been specified. If no symbol definition section exists one is created. This option will also creates the archive file if it does not exist. u update files in the archive during a r (replace) operation. The files are added to the archive in exactly the same manner as replace except that an existing archive member will be retained (in its original position) if it has a modified more recently than the file being added. Note that this modifier acts as if a r operation has been specified (even it has not), and will actually override any other previously specified operation. v verbose; print additional diagnostic messages while processing the archive. Positional Modifiers The following modifiers specify where in the archive files are moved to or added. If any of these modifiers are specified then the second option to ar86 must be the name of an archive member. a after; files are placed after the specified archive member. b before; files are placed before the specified archive member. i same as b. EXAMPLES
To see the contents of an archive ar86 tv libfile.a To add some files to an archive ar86 r libfile.a file1.o file2.o to add some files after a member named mem.o and to update the symbol table ar86 rsa mem.o libfile.a file1.o file2.o BUGS
A l modifier will be accepted but ignored. RESTRICTIONS
This command is intended for use only with object files created using the Dev86/ELKS toolchain. SEE ALSO
as86(1), bcc(1), ld86(1) AUTHORS
(C) 1988, 1990 Free Software Foundation Inc. Changes for ar86 by Greg Haerr <greg@censoft.com>. COPYRIGHT
The manual page was written for Debian GNU/Linux, (C) 2006 Shyamal Prasad <shyamal@member.fsf.org>. It is distributed under the terms of the GNU General Public License version 2 (or any later version released by the Free Software Foundation). May, 2006 ar86(1)
All times are GMT -4. The time now is 10:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy