10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. Shell Programming and Scripting
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
3. Shell Programming and Scripting
Hi Freinds ,
I have 2 files .
File 1
|nag|HYd|1|Che
|esw|Gun|2|hyd
|pra|bhe|3|hyd
|omu|hei|4|bnsj
|uer|oeri|5|uery
File 2
|nag|HYd|1|Che
|esw|Gun|2|hyd
|uer|oi|3|uery
output : (9 Replies)
Discussion started by: i150371485
9 Replies
4. UNIX for Dummies Questions & Answers
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
5. Shell Programming and Scripting
hi;
i am looking for simple search script that find string from file1 in file 2
file 1 contain a loot of string like:
204080111111111
204080222222222
204080333333333
in each row
and i would like to take the first row for example 204080111111111 from file1 and find it in file2 when it... (1 Reply)
Discussion started by: kpinto
1 Replies
6. Shell Programming and Scripting
Hi all,
Please your help with this.
I have 2 files,
File_1-->contains a column of N numbers
File_2-->contains many lines with other info and numbers from File_1 within it.
I would like to get from File_2 all the lines containing within the same line each of N numbers from File_1... (4 Replies)
Discussion started by: cgkmal
4 Replies
7. Shell Programming and Scripting
Hi All,
I have two files say file1 and file2.
I want to check the number of records in file1 and if its atleast 2 (i.e., 2 or greater than 2 ) then I have to check records in file2 .If records in file2 is atleast 1 (i.e. if its not empty ) i have to set some conditions .
Could you pls... (3 Replies)
Discussion started by: mavesum
3 Replies
8. Shell Programming and Scripting
I'm trying to compare two files using AWK, where if field2 of both files match, replace field1 of file1 with field1 of file2 and if there is no match just print the line of file1.
file1.txt (has empty first field)
:ABBATOM:B:H:1992
:ABBA TROJAN:B:H:1993
:ABBES FIRST HOPE:B:M:1997
:ABBEYS... (4 Replies)
Discussion started by: RacerX
4 Replies
9. Shell Programming and Scripting
I have two files - file1 and file2. Now I want records in file2 those are not exist in file1. How to grep this ?
eg:
file1
08941
08944
08945
08946
08947
file2
08942 08944 5
08942 08945 5
08942 08946 4
08942 08947 6
08942 08952 4
08942 08963 5
08942 ... (3 Replies)
Discussion started by: suresh3566
3 Replies
10. Shell Programming and Scripting
I have an Awk string-compare problem and have searched the internet and forums for a solution i could use but cannot find a solution i understand to make work with my particular problem:
I need to compare (field1 field2 field3 of File1) against (field1 of File2) and if they match print out... (6 Replies)
Discussion started by: RacerX
6 Replies