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

Recommended Answers

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

Jump to Post

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.