0

Suppose that file1, file2, file3, file4, and file5x each contain a list of new usernames to be added to the system, but you only have time to add the first 50 users and you need to remove duplicate usernames and save the results to a file named usernames. What would be the UNIX command to do this?

3
  • 2
    cat file1 file2 file3 | uniq > usernames Commented Oct 8, 2013 at 13:41
  • 1
    cat f1 <(echo) f2 <(echo) f3 <(echo) | sort | uniq > usernames the sort is necessary as uniq only filters out adjacent duplicates. Commented Oct 8, 2013 at 13:41
  • cat file* | sort -u Commented Oct 8, 2013 at 13:42

1 Answer 1

3

Use:

cat file1 file2 .... fileNN | sort -u
Sign up to request clarification or add additional context in comments.

1 Comment

Or cat file[1-5] for this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.