Reputation: 137
I have the below output from unix:
$ diff -y --suppress-common-lines backup.txt newfile.txt
> `jjj' int,
i need only jjj : int as output. tried the below didnt work as expected:
$ diff -y --suppress-common-lines backup.txt newfile.txt | grep -i '>' |tr -d '[>]' |sed 's/,//g'
Upvotes: 1
Views: 124
Reputation: 16912
The most common reasons for this not working are:
UTF-8
.sed
.)\n
), such as \r\n
(Windows) or \r
(MacOS).\t
) characters in the file.After you have fixed the above, try this:
diff -Ewy -r --suppress-common-lines -aB -W 512 file.txt file2.txt | tr -d '[>]'
Upvotes: 1
Reputation: 4865
suggesting to try gawk
script:
diff -y --suppress-common-lines backup.txt newfile.txt | gawk '{print $1 ":" $2}' FPAT="[[:alnum:]]+"
Upvotes: 1