[ILUG] BaSh or perl scripting q

Padraig Brady padraig at antefacto.com
Fri Aug 31 12:20:23 IST 2001


Padraig Brady wrote:

> Padraig Brady wrote:
>
>> How about:
>>
>> find /path/of/indexfile /dir/to/scan -type f | xargs cat | tr -cs 
>> "[:alnum:]-" "\n" | sort | uniq -u
>
>
> Following should be better (allows ' in words and ignores case 
> differences):
>
> find /path/of/indexfile /dir/to/scan -type f | xargs cat | tr -cs 
> "[:alnum:]-'" "\n" | sort -f  | uniq -iu
>
> Padraig


And the following should be even better :-) as it will handle the case 
where there are out of date
words in the index file. I.E. words in the index file that aren't in any 
other files should not be reported
according to your previous specs:

find /path/of/indexfile /path/of/indexfile /dir/to/scan -type f |
xargs cat |
tr -cs "[:alnum:]-'" "\n" |
sort -f  |
uniq -iu

If you wanted to report all "out of date" words in the index you could do:

find /path/of/indexfile /dir/to/scan -type f |
xargs cat |
tr -cs "[:alnum:]-'" "\n" |
sort -f  |
uniq -iu |
cat /pat/of/indexfile - |
sort -f |
uniq -iu

Padraig.






More information about the ILUG mailing list