this is the content of test file:

this this  
this that  
is that  
a that  
MAP that  
map that  

when I do uniq testCase -f1, the result is:

this this  
this that  

which is reasonable, but if I run: testCase -f2, I get:

this this 

why is this happening? and can someone tell me what is the default delimiter of -f, it is not in man.

link|improve this question
What did you expect to happen instead? – Lightness Races in Orbit Apr 24 '11 at 17:02
"Delimiter", not "deliminator". – Lightness Races in Orbit Apr 24 '11 at 17:03
feedback

migrated from stackoverflow.com Apr 25 '11 at 20:10

This question came from our site for professional and enthusiast programmers.

1 Answer

From man uniq:

A field is a run of blanks (usually spaces and/or TABs), then non-blank characters. Fields are skipped before chars.

With -f2 you're skipping all your fields, so only the first line gets output, all the others are equal after the second field (none have more than two).

link|improve this answer
should be accepted. – sehe Apr 24 '11 at 16:57
this helps a lot, thanks – Anonymous Apr 24 '11 at 17:29
feedback

Your Answer

 
or
required, but never shown