Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from Apr 25 '11 at 20:10

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

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

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).

share|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

You must log in to answer this question.