Reputation: 6258
I just want to take the difference of two files and write them to another without patch tags like + or - or diff tags like > or <. I understand how patches work and how to use the following commands:
diff file1.txt file2.txt | grep ">" > difffile.txt
diff -u file1.txt file2.txt > difffile.patch
patch original.txt < difffile.patch
but when I open my difffile.txt from the first command, I get something like this:
> some line of text
> some other line of text
when what I reallly want is:
some line of text
some other line of text
I thought that maybe indexing the string like
${stringname:2}
would work, but I don't know how to use that with grep or how to index a grep string.
I'm actually parsing html and xml and just want the values differences in some file. I don't know how to do that.
Upvotes: 0
Views: 38
Reputation: 290415
If you just want to remove the first two characters of every line, cut
is your friend:
cut -c3- file
$ cat a
hello this is me
and this is you
$ cut -c3- a
llo this is me
d this is you
Upvotes: 1