diff doesn't give same output format as input. How do I get that? For example
file1 contains
file 2 contains
diff file1 file2>file3
and file3 contains
The output is right but I don't want the symbol <. Please help me out in this regard.

Recommended Answers

All 2 Replies

You can output for RCS (Revision Control System) and ed scripts by using -n or -e:

diff -n file1 file2 > file3
diff -e file1 file2 > file3

Check man diff for more information. Or you can use the awk command:

diff file1 file2 | awk '/>/ || /</ { print $2 }' > file3

What cereal is says is that you should RTFM! Linux man pages are there so you can figure out simple stuff by yourself...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.