Hi
I have two files in unix. I need to compare two files and print the differed lines in other file
Eg
file1
1111
2222
3333
file2
1111
2222
3333
4444
5555
newfile
4444
5555
Thanks In advance
Hi
I have two files in unix. I need to compare two files and print the differed lines in other file
Eg
file1
1111
2222
3333
file2
1111
2222
3333
4444
5555
newfile
4444
5555
Thanks In advance
comm -3 file1 file2>newfile
if I do this then extra space is getting added at begining of each line in new file
printf "%s\n" $(comm -3 file1 file2)>newfile
If the words/lines contain spaces:
rm newfile&&comm -3 file1 file2|while read;do printf "%s\n" "$REPLY">>newfile;done