Skip to content

Uniq: Implement -f option #122

@marcospb19

Description

@marcospb19

Description:

Implement -f/--skip-fields to Uniq.

From the standard:

-f fields
Ignore the first fields fields on each input line when doing comparisons, where fields is a positive decimal integer. A field is the maximal string matched by the basic regular expression:
[[:blank:]]*[^[:blank:]]*

If the fields option-argument specifies more fields than appear on an input line, a null string shall be used for comparison.


Obs: I did not implemented in #121 because I could not understand while testing with GNU Coreutils' Uniq how this works.

When I called:

uniq -c -f 1 << EOF       
a b
c b
EOF

I expected:

      2 b

But instead, I got:

      2 a b

Metadata

Metadata

Assignees

Labels

A-toolArea: Binary toolC-enhancementCategory: An issue proposing an enhancement or a Pull Request with one.HacktoberfestHacktoberfest

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions