473,382 Members | 1,204 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

diff command in unix

snowfall
I need to find the difference of two files and save it in third file and process it..
But the outpur of diff command is coming with the 'line number - difference' code.

Eg of my output

i22,26d21
< Use the bc program to convert from decimal to hexadecimal.
< To do so, use the obase command to set the base for output:
39c34,35
< See Section 5.6 for more examples of using bc.

But i want only the lines and not the 'i22,26d21 & < Symbol'..

Pls help..

TIA
Mar 13 '08 #1
4 3811
docdiesel
297 Expert 100+
Hi,

if you just need the lines, means their content, you could get them with

Expand|Select|Wrap|Line Numbers
  1. diff .... | grep ^\< | sed s/^\<\ //
But this doesn't give you the information, which line is new nor which one's changed or deleted.

Regards,

Bernd
Mar 13 '08 #2
Hi,

if you just need the lines, means their content, you could get them with

Expand|Select|Wrap|Line Numbers
  1. diff .... | grep ^\< | sed s/^\<\ //
But this doesn't give you the information, which line is new nor which one's changed or deleted.

Regards,

Bernd
Sorry i dont understand.. Is the syntax like this??

Expand|Select|Wrap|Line Numbers
  1. diff file1 file2 > outfile | grep ^\< | sed s/^\<\ //
pls help...
Mar 13 '08 #3
docdiesel
297 Expert 100+
Hi,

for just getting the new/changed/deleted lines use

Expand|Select|Wrap|Line Numbers
  1. diff  file1.txt file2.txt | grep ^\< | sed s/^\<\ //
If you need the differences in diff.txt, use
Expand|Select|Wrap|Line Numbers
  1. diff  file1.txt file2.txt | tee diff.txt | grep ^\< | sed s/^\<\ //
Regards,

Bernd
Mar 13 '08 #4
Hi,

for just getting the new/changed/deleted lines use

Expand|Select|Wrap|Line Numbers
  1. diff  file1.txt file2.txt | grep ^\< | sed s/^\<\ //
If you need the differences in diff.txt, use
Expand|Select|Wrap|Line Numbers
  1. diff  file1.txt file2.txt | tee diff.txt | grep ^\< | sed s/^\<\ //
Regards,

Bernd
Thanks Bernd............................................. .......
Mar 14 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Guillaume Lahitette | last post by:
Hello everyone, I am looking for a lightweight Java Applet to diff and merge two text files. The functionality would be a subset of what WinMerge (http://winmerge.sourceforge.net) offers: -...
3
by: Nick Allen | last post by:
After using ndiff from difflib, the function restore would return the sequence that generated the delta. Unfortunately, restore does not do the same for unified_diff. I do not see any similar...
1
by: Mark Steinberger | last post by:
Where can I get a perl implementation of the unix diff utility? Mark
6
by: Lionel van den Berg | last post by:
Hi all, I'm wondering if there is a diff function like the unix command in C++? In fact I would like to know if you can call the unix (I should say *nix) command from within a c++ application?...
5
by: Anil | last post by:
Hi, I have a HTML webpage that is updated every week. I mean the layout gets chaged every week(not a very drastic change). Like, edit box is changed to drop down menu or a field is moved from...
8
by: TonyHa | last post by:
Hello, Does any one have using Python to write a Unix "diff" command for Window? Tony Ha.
2
by: Steve Manes | last post by:
My company offers an ASP service for advertising companies using PG. For contractual reasons, each client gets its own replicated database. This presents a problem whenever a new feature/fix...
6
by: Igor Shevchenko | last post by:
Hi! Suppose I have "pg_dump -s" of two pg installs, one is "dev", another is "production". Their schemas don't differ too much, and I want to get a "diff -u"-like schema diff so I can quickly...
3
by: AirYT | last post by:
Hello, I'm looking for an implementation for diffing 2 (text) files and spitting out the output using php only. i would like to extend this to use ftp to diff two files on two ftp servers, or...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.