UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old August 19th, 2003, 11:55 PM
jin jin is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 22 jin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
"diff" question

hi everybody,

i had a question regarding the "diff" command. if i do
"diff filea fileb > filec"

is there a way to keep only the data differences ignoring the ">", "----", line numbers, etc that diff prints along with the differences ??

any help would be greatly appreciated

Reply With Quote
  #2  
Old August 22nd, 2003, 03:13 PM
Prime Mover Prime Mover is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Jersey
Posts: 64 Prime Mover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Well, looking at the man pages for diff doesn't seem too encouraging for having diff itself do it, or any of its variants for that matter either (taken from man pages on a Solaris 8 Sparc system)

You could get the results you want from other programs however:

First, diff the files to a third file, I'll call it newfile, and then run something like the following:

cat newfile | sed s/\<\ //g | sed s/\>\ //g > cleanfile

Basically, that will remove all the '<' and '>' and the following spaces (so as to align the output properly to the left margin).

Run another sed command and you could get rid of the '---' and number lines as well. Or, awk might work as well.

Hope this helps.

-Gary

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > "diff" question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway