Sponsored Content
Top Forums Shell Programming and Scripting Compare multiple fields in file1 to file2 and print line and next line Post 302297533 by gillesc_mac on Friday 13th of March 2009 06:00:21 PM
Old 03-13-2009
Thank you again, but I neglected to remember another restriction. I need to match multiple fields for example

File1 File2
$9 = $1
$1 = $3
$2 = $4
$3 = $5
$4 = $6
$5 = $7
$6 = $8
$7 = $9

But again each field is not necessarily the same precision. I tried adding additions to your script but I am just beginning to learn.

Thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

insert file2 after line containing patternX in file1

file1:- aaaa bbbb cccc dddd eeee file2:- 1111 2222 3333 4444 I want to insert file2 after pattern bbbb to come up with a finished file of :- aaaa bbbb 1111 2222 3333 4444 (5 Replies)
Discussion started by: repudi8or
5 Replies

2. Shell Programming and Scripting

append text from file1 to the end of each line in file2

hi; my file2.txt:portname=1;list=10.11;l- portname=2;list=10.12;l- portname=3;list=10.13;l- ... my file1.txt:;"{'sector=%27'}"\&> so; i want to see:portname=1;list=10.11;l-;"{'sector=%27'}"\&> portname=2;list=10.12;l-;"{'sector=%27'}"\&> portname=3;list=10.13;l-;"{'sector=%27'}"\&>... (4 Replies)
Discussion started by: gc_sw
4 Replies

3. Shell Programming and Scripting

[Solved] delete line from file1 by reading from file2

Hi All, I have to arrange one of the text file by deleting specific lines. cat file1.txt 3595 3595 -0.00842773 -0.0085077 0.00368851 12815 12815 -0.00929239 0.00439785 0.0291697 3747 3747 -0.00974353 0.00228922 0.0225058 3574 3574 -0.00711399 -0.00315748 0.0141206 .... 12734... (7 Replies)
Discussion started by: senayasma
7 Replies

4. Shell Programming and Scripting

look for line from FILE1 at FILE2

Hi guys! I'm trying to write something to find each line of file1 into file2, if line is found return YES, if not found return NO. The result can be written to a new file. Can you please help me out? FILE1 INPUT: WATER CAR SNAKE (in reality this file has about 600 lines each with a... (2 Replies)
Discussion started by: demmel
2 Replies

5. Shell Programming and Scripting

Using regex's from file1, print line and line after matches in file2

Good day, I have a list of regular expressions in file1. For each match in file2, print the containing line and the line after. file1: file2: Output: I can match a regex and print the line and line after awk '{lines = $0} /Macrosiphum_rosae/ {print lines ; print lines } ' ... (1 Reply)
Discussion started by: pathunkathunk
1 Replies

6. Shell Programming and Scripting

Compare file1 for matching line in file2 and print the difference in matching lines

Hello, I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies

7. Shell Programming and Scripting

Compare file1 header count with file2 line count

What I'm trying to accomplish. I receive a Header and Detail file for daily processing. The detail file comes first which holds data, the header is a receipt of the detail file and has the detail files record count. Before processing the detail file I would like to put a wrapper around another... (4 Replies)
Discussion started by: pone2332
4 Replies

8. Shell Programming and Scripting

Match single line in file1 to groups of lines in file2

I have two files. File 1 is a two-column index file, e.g. comp11084_c0_seq6:130-468(-) comp12746_c0_seq3:140-478(+) comp11084_c0_seq3:201-539(-) comp12746_c0_seq2:191-529(+) File 2 is a sequence file with headers named with the same terms that populate file 1. ... (1 Reply)
Discussion started by: pathunkathunk
1 Replies

9. UNIX for Dummies Questions & Answers

Compare file1 and file2, print matching lines in same order as file1

I want to print only the lines in file2 that match file1, in the same order as they appear in file 1 file1 file2 desired output: I'm getting the lines to match awk 'FNR==NR {a++}; FNR!=NR && a' file1 file2 but they are in sorted order, which is not what I want: Can anyone... (4 Replies)
Discussion started by: pathunkathunk
4 Replies

10. 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
gd_bof(3)							      GETDATA								 gd_bof(3)

NAME
gd_bof -- report the start of data in a field SYNOPSIS
#include <getdata.h> off_t gd_bof(DIRFILE *dirfile, const char *field_code); DESCRIPTION
The gd_bof() function queries a dirfile(5) database specified by dirfile and returns the sample number of the beginning-of-field marker for the vector field given by field_code. The caller should not assume that the beginning-of-field marker falls on a frame boundary. The beginning-of-field marker is never nega- tive. For a RAW field, the beginning-of-field corresponds to the frame offset of that field (see gd_frameoffset(3)). The beginning-of-field for all other vector field type is the same as the beginning-of-field of whichever of its input fields that starts latest. The beginning-of- field marker for the special field INDEX is always zero. The beginning-of-field marker for a field containing no data is in the same location as, or after, its end-of-field marker (see gd_eof(3)). For a RAW field, the difference between the locations of the beginning- and end-of-field markers indicates the number of samples of data actually stored on disk. The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3). RETURN VALUE
Upon successful completion, gd_bof() returns the sample number of the end-of-field marker for the indicated field. On error, it returns -1 and sets the dirfile error to a non-zero error value. Possible error values are: GD_E_BAD_CODE The field specified by field_code or one of the fields it uses as input was not found in the database. GD_E_BAD_DIRFILE The supplied dirfile was invalid. GD_E_BAD_REPR The representation suffix specified in field_code, or in one of its inputs was not recognised. GD_E_DIMENSION A scalar field was found where a vector field was expected in the definition of field_code or one of its inputs, or else field_code itself specified a scalar field. GD_E_RECURSE_LEVEL Too many levels of recursion were encountered while trying to resolve field_code. This usually indicates a circular dependency in field specification in the dirfile. The dirfile error may be retrieved by calling gd_error(3). A descriptive error string for the last error encountered can be obtained from a call to gd_error_string(3). SEE ALSO
dirfile(5), dirfile-encoding(5), gd_open(3), gd_eof(3), gd_error(3), gd_error_string(3), gd_nframes(3) Version 0.7.0 15 October 2010 gd_bof(3)
All times are GMT -4. The time now is 08:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy