GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Compare Two Text Files Using Diff
Operating System - HP-UX
1846636
Members
1482
Online
110256
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
03-19-2003 11:34 PM
03-19-2003 11:34 PM
Compare Two Text Files Using Diff
Hi, any one can help me, I have one problem:
I have 2 directories: /diff and /diff1
In both of those directories, there are many files that have the same name :
file1,file2,file3 .......,filen....
How to create a log file that describe the difference between the two text files and have the following format:
File_Name Difference file created date
file1 /diff/file1:blabla.... dd-mm-yyyy
/diff/diff1/file1:blabla... dd-mm-yyyy
file2 /diff/file2:blabla.... dd-mm-yyyy
/diff/diff1/file2:blabla... dd-mm-yyyy
..... .......... .........
filen /diff/filen:blabla.... dd-mm-yyyy
/diff/diff1/filen:blabla... dd-mm-yyyy
Thank you in advance.
I have 2 directories: /diff and /diff1
In both of those directories, there are many files that have the same name :
file1,file2,file3 .......,filen....
How to create a log file that describe the difference between the two text files and have the following format:
File_Name Difference file created date
file1 /diff/file1:blabla.... dd-mm-yyyy
/diff/diff1/file1:blabla... dd-mm-yyyy
file2 /diff/file2:blabla.... dd-mm-yyyy
/diff/diff1/file2:blabla... dd-mm-yyyy
..... .......... .........
filen /diff/filen:blabla.... dd-mm-yyyy
/diff/diff1/filen:blabla... dd-mm-yyyy
Thank you in advance.
Kamal Mirdad
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2003 11:54 PM
03-19-2003 11:54 PM
Re: Compare Two Text Files Using Diff
hi,
try: dircmp -d dir1 dir2
dircmp examines dir1 and dir2 and generates various tabulated information about the contents of the directories. Sorted listings of files that are unique to each directory are generated for all the options. If no option is entered, a sorted list is output indicating whether the filenames common to both directories have the same contents.
hth
Yogeeraj
try: dircmp -d dir1 dir2
dircmp examines dir1 and dir2 and generates various tabulated information about the contents of the directories. Sorted listings of files that are unique to each directory are generated for all the options. If no option is entered, a sorted list is output indicating whether the filenames common to both directories have the same contents.
hth
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2003 11:55 PM
03-19-2003 11:55 PM
Re: Compare Two Text Files Using Diff
Try this
#!/bin/sh
cd
for file in `ls diff`
do
ls -l diff/$file | awk '{printf("%s %s-%s-%s\n",$9,$7,$6,$8)}'
ls -l diff1/$file | awk '{printf("%s %s-%s-%s\n",$9,$7,$6,$8)}'
echo "diff/$file | diff1/$file"
sdiff diff/$file diff1/$file
echo
done
Chris
#!/bin/sh
cd
for file in `ls diff`
do
ls -l diff/$file | awk '{printf("%s %s-%s-%s\n",$9,$7,$6,$8)}'
ls -l diff1/$file | awk '{printf("%s %s-%s-%s\n",$9,$7,$6,$8)}'
echo "diff/$file | diff1/$file"
sdiff diff/$file diff1/$file
echo
done
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2003 01:20 AM
03-20-2003 01:20 AM
Re: Compare Two Text Files Using Diff
Hi,
try the attached script as a starting point. DIR1 and DIR2 must be configured to point at the two dirs you want to compare.
regards,
John K.
try the attached script as a starting point. DIR1 and DIR2 must be configured to point at the two dirs you want to compare.
regards,
John K.
it would be nice if you always got a second chance
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP