Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 2nd November 2012, 10:36 PM
eaglelinux's Avatar
eaglelinux Offline
Registered User
 
Join Date: Jun 2011
Posts: 158
linuxchrome
diff command !

Hello !

When I use diff to show difference between two files, I take this output:
HTML Code:
5,30c5,6
<  10.10.50.6
<  10.10.50.7
<  10.10.50.10
<  10.10.50.131
<  10.10.50.132
<  10.10.50.133
<  10.10.50.134
<  10.10.50.135
<  10.10.50.136
<  10.10.50.138
<  10.10.50.139
<  10.10.50.140
<  10.10.50.141
<  10.10.50.142
<  10.10.50.143
<  10.10.50.145
<  10.10.50.146
<  10.10.50.147
<  10.10.50.148
<  10.10.50.153
<  10.10.50.154
<  10.10.50.155
<  10.10.50.156
<  10.10.50.157
<  10.10.50.158
<  10.10.50.161
---
>  
> 
Now I want to use diff to take an output without symbols " --- > > ", " < ", " 5,30c5,6 " , so only difference between texts.

Thank you !
Reply With Quote
  #2  
Old 2nd November 2012, 11:45 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,107
linuxfirefox
Re: diff command !

I think you will be confused by the result - with lots of duplicate lines (normally there are a preceding/trailing 5 lines to give context).

Having just the differences without knowing which is which is useless.

Perhaps a different command is what you want - read the man page on "comm", which identifies common lines, lines in the first file that aren't in the second, and/or lines in the second that are not in the first.
Reply With Quote
  #3  
Old 3rd November 2012, 12:23 AM
stevea's Avatar
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,302
linuxfirefox
Re: diff command !

Try 'diff -Nau' and for directories full of file use 'diff -Naur dir1 dir2'
You can use the output as input to 'patch' and related utilities.
Quote:
Originally Posted by eaglelinux View Post
Hello !

When I use diff to show difference between two files, I take this output:
HTML Code:
5,30c5,6
<  10.10.50.6
...
---
>  
Now I want to use diff to take an output without symbols " --- > > ", " < ", " 5,30c5,6 " , so only difference between texts.

Thank you !
No you DON'T want that (despite what you think). If you didn't have the initial characters you would have no means to tell which lines were included vs. excluded.

Learn to use diff -u... and patch.
If you want to persist in doing things the hard way, then learn to use grep and sed.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #4  
Old 3rd November 2012, 10:28 AM
eaglelinux's Avatar
eaglelinux Offline
Registered User
 
Join Date: Jun 2011
Posts: 158
linuxchrome
Re: diff command !

Hi,

Thank you very much for your support but now I have solved this problem using:

HTML Code:
diff text1.txt text2.txt > res.txt; cat res.txt | grep 10.10.50.* > res1.txt
Now the results in file res1.txt are OK.

Thank you !
Reply With Quote
  #5  
Old 3rd November 2012, 10:44 AM
stevea's Avatar
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,302
linuxfirefox
Re: diff command !

Quote:
diff text1.txt text2.txt > res.txt; cat res.txt | grep 10.10.50.* > res1.txt
diff text1.txt text2.txt | grep 10.10.50.* > res1.txt
Use the pipe Luke, it surrounds us and penetrates us. It binds the galaxy together
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
Reply

Tags
command, diff

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
F12 two diff NICs scott32746 Servers & Networking 5 23rd August 2010 08:47 PM
Assigning diff languages to diff users deacky_blue Using Fedora 2 17th February 2009 01:07 PM
How-To Apply a diff awt586 Using Fedora 3 24th February 2007 07:57 PM
dial-up diff. between FC3 and FC5 fandc Servers & Networking 4 17th April 2006 05:52 PM


Current GMT-time: 21:25 (Friday, 24-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat