Paul E Condon wrote:
> I report a feature of uniq which seems IMHO to be a bug:
> I am using test files containing the following lines:
>
> tsttmp1:
> 2/dl1/f04 lnk2/f04 Europe but where?
> 2/dl1/f04a lnk2/f04 Europe but where?
>
> tsttmp2:
> 2/dl1/f04 lnk2/f04 Europe but where?
> 2/dl1/f04a lnk2/f04 Europe but where?
>
> The space between fields in both files is strings of space characters. No
> tabs are
> used.
>
> I use the commands:
> $ uniq -f 1 -W 1 -D tsttmp1
> and
> $ uniq -f 1 -W 1 -D tsttmp2
>
> In both commands, the options call for examining _only_ field 2, and should
> report two
> duplicate lines in both files.
>
> What keeps there from being a report for tsttmp1 is the differing number
> of leading blanks in the two lines.
>
> I suggest a fix for this in uniq:
> 1/ change the documenatation to accurately describe the actual behavior.
> 2/ add an option, -b, to uniq that tells it to ignore leading blanks in a
> field, as is
> available in sort.
A few points:
1. -W is debian specific
2. -W is removed in newer debian packages
3. Yes uniq should be able to specify fields like sort
4. Perhaps the following workaround would suffice?
tr -s ' ' < tsttmp1 | uniq -f1 -W1 -D
Pádraig.
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils