Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com 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
add comment

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

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.