Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

i have a list of files in a folder. the list of files is displayed using:


now, i want to pipe that to uniq so it'll ignore the first 6 charactes before comparing.
is it possible? or perhaps i need to use another command?
thank you

share|improve this question
up vote 2 down vote accepted

pipe the output of ls first to sed to strip away the first X characters and then pipe it to uniq.

% ls | sed -e 's/.\{X\}//' | uniq

(note: replace X with 6 in your case)

share|improve this answer
i see. thank you – bks May 18 '10 at 11:49

Use the -s (--skip-chars) option if your version of uniq has it.

ls | uniq -s 6


ls | uniq --skip-chars=6
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.