Deepti Agarwal
Deepti Agarwal

Reputation: 11

Merge two files in linux and ignore any repetition

Can anyone provide me with a shell script in linux that merges two files and saves it in a third file. However I want that if there is any common data in both the files then the common lines should only be saved once. Please ask if you need any more details. Thanks in advance!!

Upvotes: 1

Views: 1484

Answers (1)

eckes
eckes

Reputation: 67047

Simplest way:

cat one two | sort -u > third

But this is probably not what you want...

You mentioned merging in your question: what do you mean with that? If it's not that simple as I assumed in my code above, provide sample files and tell us what you want to achieve.

Upvotes: 4

Related Questions