Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2004 07:54 AM
04-27-2004 07:54 AM
I want to do a diff between two files and want output that lines not present in second file.
Ex diff file1 file2
output only lines present in file1 and not file2.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2004 08:04 AM
04-27-2004 08:04 AM
Re: Diff
comm -1 file1 file2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2004 08:11 AM
04-27-2004 08:11 AM
Re: Diff
Try
sdiff -s file1 file2
Do "man sdiff" for more details / help.
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2004 08:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2004 08:15 AM
04-27-2004 08:15 AM
Re: Diff
Col1 = lines that appear ONLY in file1
Col2 = lines that appear ONLY in file2
col3 = lines that appear in both files
To show only column one, you have to suppress the other two columns, so what you want is:
comm -23 file1 file3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2004 08:16 AM
04-27-2004 08:16 AM
Re: Diff
cat f1 f2 |sort -u >tmpf
cat f2 tmpf |sort |uniq -u
cat f1 tmpf |sort |uniq -u
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2004 10:35 AM
04-27-2004 10:35 AM
Re: Diff
diff file1 file2 | grep "^< " | cut -c3-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 05:25 AM
04-28-2004 05:25 AM
Re: Diff
The input files need to be sorted.
You could sort into temporary files before using comm.
The suggestion using uniq would be broken by lines that are duplicated within one file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 06:53 AM
04-28-2004 06:53 AM
Re: Diff
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=388167
It went on after the question was answered, just as in your case
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 03:41 PM
04-28-2004 03:41 PM
Re: Diff
-s allows you to suppress the lines common in both files so all you see are the differences, and
-w allows you to set the width of each line, which is VERY useful if you have long lines.
Suggest you try the following:
# sdiff -s -w132 file1 file2 |grep " < "
The identifier of unique findings in file1 is noted by the < sign with whitespace around it, so use spaces not tabs in front of and after the < sign.
Hope this helps, it works great for me.