03-07-2009
Not sure how to use diff and comm for my problem
Hello,
Apologies if this question has been repeated before, but I am getting myself confused even more as I scan the posts!
I have two files, file1 is a column:
1dlwa_
1s69a_
1idra_
1ngka_
And file2 has three columns (columns seperated by tabs):
1dlw a_ A
1uvy a_ A
1dly a_ A
1uvx a_ A
1s69 a_ A
I want to only extract from file2 those rows where the first & second column concatenated together matches the first column of file1. In this example above, I would only want to see:
1dlw a_ A
1s69 a_ A
And I want to save these in a new file, file3. How would I use diff, comm, or any combination of those to do it?
Thank you in advance for your help!
InfoSeeker
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Folks,
I am Diff'ing 2 identical files..and the result is, it shows all the lines from 2 files (saying nothing is being matched).
If I copy the content from 1 of the file and paste in a newly created file and then do the diff, it equals.
2 files are xml files.
I've tried many... (4 Replies)
Discussion started by: gvsreddy_539
4 Replies
2. Linux
hello,
here I am copying my code...
I am using two threads for reading and writing at com ports....one for reading and one for writing...in read thread I am using select() api....and polling again and again if there is some data to be read....but select is not returning any positive value so... (0 Replies)
Discussion started by: arunchaudhary19
0 Replies
3. Programming
hello,
here I am copying my code...
I am using two threads for reading and writing at com ports....one for reading and one for writing...in read thread I am using select() api....and polling again and again if there is some data to be read....but select is not returning any positive value so... (0 Replies)
Discussion started by: arunchaudhary19
0 Replies
4. Shell Programming and Scripting
Hi,
When i use diff command, i get the output like this
2c2
< Table Name: AAA Row Count:96 SUM(F1): 3739 MAX(F1):77 MIN(F1): 0 AVG(F1): 38.9479167 LENGTH(LINE): 2260
---
> Table Name: AAA Row Count:96 SUM(F1): 4009 MAX(F1):77 MIN(F1): 0 AVG(F1): 40.9479167 LENGTH(LINE): 2260
4a5,10
>... (6 Replies)
Discussion started by: ragavhere
6 Replies
5. UNIX for Dummies Questions & Answers
I am trying to do a diff between two files using "diff" command.I dont need my output to be printed using extra symbols ">" and "<" as we usually see for the diff command. Even to excude these characters in each line of the output, my diff output has inturn many symbols ">" and "<".
Please help.... (2 Replies)
Discussion started by: pharitha
2 Replies
6. Shell Programming and Scripting
hi,
I have two unsorted files and want to delete the lines which are common to both.
file 1:
S1069656304010437
S1069656304010449
S1470204501005393
S1069656304010474
S0001209208001294
S0000000012345678
S0001457507000590
S0002641707000784
S1470204501005381
S0001457507000280... (4 Replies)
Discussion started by: jathin12
4 Replies
7. UNIX for Dummies Questions & Answers
Hello Guys,
I am a newbie to Unix. I was going through the diff command with example
like this,
$ cat 1
1
2
4
0
8
9
$ cat 2
1
0
3
2
8
My output is like this: (1 Reply)
Discussion started by: mahesh_raghu
1 Replies
8. Shell Programming and Scripting
Hi All,
I havae 2 files like this
File1.dat.tar.gz--- has
+667866066123|20110506
+667866066866|20110405
File2.dat.tar.gz -----contains
+447866066123|20110505
+447866066866|20110405
If I give
Gzcat File1.dat.tar.gz | cut –d “|” –f 1 > out1.dat
Gzcat File2.dat.tar.gz| cut –d... (4 Replies)
Discussion started by: suresh01_apk
4 Replies
9. Shell Programming and Scripting
Hi,
I need to get only different rows from comparing two files , i donot need the place of row or any other error comments , just my data , Can anyone help me please?
example:
$Diff -b reham.txt reham1.txt
7a8(DON'T NEED IT)
> hany 4/4/1989 $100,000
\ No newline at end... (9 Replies)
Discussion started by: Reham.Donia
9 Replies
10. Shell Programming and Scripting
I am using the diff command, but i cant figure out why it is displaying these strange numbers and letters
diff spellExample spellExample.bak
1c1
< I went to a garden party
---
> I went to a gadren party
3c3
< bunch of my old friends did something
---
> bnuch of my old freinds did... (2 Replies)
Discussion started by: football12345
2 Replies
XZDIFF(1) XZ Utils XZDIFF(1)
NAME
xzcmp, xzdiff, lzcmp, lzdiff - compare compressed files
SYNOPSIS
xzcmp [cmp_options] file1 [file2]
xzdiff [diff_options] file1 [file2]
lzcmp [cmp_options] file1 [file2]
lzdiff [diff_options] file1 [file2]
DESCRIPTION
xzcmp and xzdiff invoke cmp(1) or diff(1) on files compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are passed
directly to cmp(1) or diff(1). If only one file is specified, then the files compared are file1 (which must have a suffix of a supported
compression format) and file1 from which the compression format suffix has been stripped. If two files are specified, then they are uncom-
pressed if necessary and fed to cmp(1) or diff(1). The exit status from cmp(1) or diff(1) is preserved.
The names lzcmp and lzdiff are provided for backward compatibility with LZMA Utils.
SEE ALSO
cmp(1), diff(1), xz(1), gzip(1), bzip2(1), zdiff(1)
BUGS
Messages from the cmp(1) or diff(1) programs refer to temporary filenames instead of those specified.
Tukaani 2010-09-27 XZDIFF(1)