# Several shell and script questions for text manipulation



## Beeblebrox (Nov 13, 2013)

I have several unrelated difficulties figuring out how to do these:


I need to compare text in two files, then get a list of strings which are unmatched; preferably with the name of file that has the extra string. Think of for example, two separate files containing a list of origin/port from which you want to pull unique records and also know which file has that unique record.
I have placed wine in a i386 chroot (because I want to test difference with the i386-wine port). I also need to use winetricks script, but since the script is unaware of the aliases I have created, it fails to find wine. The developer advises to use below syntax, but this is for bash. How is this done in sh, and how can I create an alias for it?
	
	



```
WINE=/path/to/wine WINESERVER=/path/to/wineserver winetricks verb
```

Finally, I need to start cleaning out my old backed-up folders and files. The problem I have with existing software that does this, is that I may have 10 copies of the same file with maybe 8 of them exactly the same and 2 of the copies having modifications. In this case I would like to
a) delete 7 of the identical 8 and
b) then see a layout of the difference between the 3 remaining files. The problem with certain software is that if there is just one line inserted near the top, the entire document shows up as "very different" since the lines in one of the files has shifted down by one.

I would greatly appreciate any ideas for the above.


----------



## jb_fvwm2 (Nov 13, 2013)

/usr/ports/textproc/meld  may be useful for the third question. For the first, maybe tweak the following pipe til it works ... 
`#  sort file.1 file.1 file.2 | uniq -u | less`


----------



## Beeblebrox (Nov 13, 2013)

I was using `sort -u` to merge files, but did not know about uniq! Now I just need to figure out how to include the filename with the output...

I played around with textproc/meld some time back. I found it insufficient for the task.


----------

