On Tue, Oct 28, 2008 at 05:38:11PM -0400, Charles Nadeau wrote:
> Hi,
>
> I am trying to remove all the lines of file2 that are in file1.
> In theory, grep -F -v -f file1 file2 should do the trick.
> The two files contain file names with their full path. Some parts of the
> paths contain spaces like:
>
> \a\b\c or d\picture1.jpg
> \a\b\cord\picture2.jpg
> \a\z\c or d\picture3.jpg
> \a\bc\c or d\picture4.jpg
> \a\bhhj\cor d\picture5.jpg
>
> Is it possible that the presence of spaces and slashes makes grep fail
> (I also tried fgrep and egrep and I got the same results)?
> Should I escape the slashes in my file paths? What about he spaces?
> Should I use sed instead of grep?
Are the spaces part of the filenames, or are they randomly added by accident?
If they are intentional, I'd assume as you have that -F should have done it.
I'd have done it another way, assuming order wasn't important:
cat file1 file2 | sort | uniq -u
> Charles Nadeau
slainte mhath, RGB
--
Richard Guy Briggs -- ~\ -- ~\ <hpv.tricolour.net>
<www.TriColour.net> -- \___ o \@ @ Ride yer bike!
Ottawa, ON, CANADA -- Lo_>__M__\\/\%__\\/\%
Vote! -- <greenparty.ca>_____GTVS6#790__(*)__(*)________(*)(*)_________________
_______________________________________________
Linux mailing list
[email protected]
http://oclug.on.ca/mailman/listinfo/linux