Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reporting the line differences

Status
Not open for further replies.

mcallaghan

IS-IT--Management
Mar 22, 2005
43
US
The situation I am having is I have 2 files and I am comparing the difference between the 2 files and reporting it to a log. The return value is something like this.

\---[changed 13]---------|-----[changed to 13-15]------

aaa |bbbb

I would like to add on to this process which would grab the line numbers before and after the changed line. In this example it would seek through my log file and find lines 13-15 I would like to grab lines above and below it and throw that into a file along with the differences. The file in this situation would grab lines 10 through 20.
Take note of this the original diff file can have multiple changes to lines. So the original log can return a value like this.

\---[changed 13]---------|-----[changed to 13-15]------

aaa |bbbb

\---[changed 20]---------|-----[changed to 20]------

bbb |cccc


So i would like to grab the lines above and below 13-15 as well as the lines above and below 20 as well.
 
Why not simply using standard utility like diff (preferably the GNU version) ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Either way the utility Diff that is used in unix and the Diff I am currently using which happens to be cleatool. Both return the same answer. I just like the way cleartoolreturns the diff because it gives more of a cleaner answer. I want to be able to grab the lines above and below that lines that are different.
 
No -C option for your diff utility ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Agree, diff or sdiff (side by side diff) seem to be the best solutions.

-------------------------
The trouble with doing something right the first time is that noboby appreciates how difficult it was.
- Steven Wright
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top