Problem in Diff command...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem in Diff command...
# 1  
Old 10-12-2011
Problem in Diff command...

Hi All,

I havae 2 files like this
File1.dat.tar.gz--- has
Code:
+667866066123|20110506
+667866066866|20110405

File2.dat.tar.gz -----contains
Code:
+447866066123|20110505
+447866066866|20110405

If I give

Code:
Gzcat File1.dat.tar.gz | cut –d “|” –f 1 > out1.dat 
Gzcat File2.dat.tar.gz| cut –d “|” –f 1 > out2.dat

Now out.dat contains 3 rows
Code:
/users/sur/file1.dat 
+667866066123
+667866066866

Out2.dat contains 3 rows
Code:
File2.dat
+447866066123
+447866066866

Code:
Diff out1.dat out2.dat

Then it says
Code:
1c1
< /users/sures_p/file1.dat
---
File2.dat

It means the first line in those 2 files are the previous filenames.
Either I have to ignore the first line from the 2 files when doing diff.

Any help is really appreciated.

Last edited by Franklin52; 10-12-2011 at 04:14 AM.. Reason: Please use code tags, thank you
# 2  
Old 10-12-2011
Not sure if they are just typos, you did a diff between out1.dat and out2.dat. You have pasted the output of out.dat and Out2.dat

what is the issue here?

--ahamed
# 3  
Old 10-12-2011
Thanks for your reply ahamed.

In my two output files I am getting the source filenames in my target output files. Now, I need to load the data in target file without having source filenames. I tried a lot. But everytime I am getting source filename in my target output files.
out.dat
Code:
/users/sur/file1.dat 
+667866066123
+667866066866

Out2.dat
Code:
File2.dat
+447866066123
+447866066866

Original output should be
out.dat
Code:
+667866066123
+667866066866

Out2.dat
Code:
+447866066123
+447866066866


Last edited by Franklin52; 10-12-2011 at 06:36 AM.. Reason: Please use code tags, thank you
# 4  
Old 10-12-2011
Code:
gzcat File1.dat.tar.gz | cut –d “|” –f 1 | sed '1d' > out1.dat

--ahamed
# 5  
Old 10-12-2011
I resolved my problem. Thanks ahamed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with diff

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

2. Shell Programming and Scripting

diff problem

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

3. UNIX for Dummies Questions & Answers

Problem with diff command

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

4. UNIX for Dummies Questions & Answers

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... (1 Reply)
Discussion started by: InfoSeeker
1 Replies

5. UNIX for Dummies Questions & Answers

Problem with diff command

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. UNIX for Advanced & Expert Users

Problem using diff command in unix

Hi, 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 "<". ... (1 Reply)
Discussion started by: pharitha
1 Replies

7. Shell Programming and Scripting

diff command help

Hi all diff file1 file 2 command will give us op of diff between two file. But it aslo give its position and sign "<" or ">". I dont want position and sign in op. Only diff of content should be come as op. Kindly help me for this. Regards Jaydeep (1 Reply)
Discussion started by: jaydeep_sadaria
1 Replies

8. Shell Programming and Scripting

diff command

All, How to exclude a directory while diff execution? For ex: To exclude file which we don't want to see diff, we have -x <filename>. Thanks in advance (1 Reply)
Discussion started by: Vichu
1 Replies

9. Shell Programming and Scripting

Problem in using diff

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

10. Shell Programming and Scripting

Diff command problem

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
Login or Register to Ask a Question