answersLogoWhite

0


Best Answer

let the first file be a.txt ,second be b.txt and the third one (final file) be c.txt

The command would be

cat a.txt b.txt | sort -u >c.txt

cat a.txt b.txt will combine the two files (with duplicates)

| (pipe) will take the output of the previous command and send it as input the next command sort -u

sort -u will sort it in ascending order taking only the unique values

sort -u > c.txt will send the sorted unique values to c.txt file

cat a.txt,b.txt give 1 2 3 4 5 6 5 6 7 89 10

sort -u will give 1 2 3 4 5 6 7 8 9 10

this output is then stored in c.txt

hope this was what you were looking for

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you combine two files without duplication using unix command?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is it possible to unzip files without any special software?

No, it is not possible to unzip files without software. When files are "zipped" they undergo compression. Most archive files undergo this compression to save space and combine files. Also, archives my be encrypted an unable to unzip without the proper software or password.


What command erases files or groups of files?

The Del or Erase command in command prompt.


How do you copy all files in a directory without copying sub directories using FTP?

All files in a directly can be copied without copying the sub directories using FTP by first highlighting them. This allows a user to specifically select only the files they want to transfer. If you are doing this via the command line interface using the mget command with a mask (such as *) will transfer all files except subdirectories.


How do you encrypt files with Command Prompt?

The command 'cipher' calls a program that is integrated with Windows that can encrypt-decrypt files.


What can you do to a file or files to reduce the size of the files or combine files to make them easier to send?

zip


What MS-DOS command can display hidden files?

The attrib command is capable of displaying files that have been marked as hidden.


What command displays a list of files and direcories at the command line?

document


What does is command do in Linux?

A command is an instruction from a user to get the computer to do something! A simple example: open a terminal and type the command "man man" (without the quotes) and the result will be the manual page of the man command.Note: The command ls stands for list the files in the current directory.


Would the ls -a command show hidden files?

Yes, in Linux or Unix, this command will show all files including hidden files in the current directoryl. In general, hidden files are files whose name begins with a period "."


What command will display files starting from z in unix?

Use the command: ls z* for those files in your current working directory.


How do you find and remove files in Linux?

From the command line: To find the files there are a variety of utilities that you can use including: find, locate, and slocate. To remove the files use the command: rm filename.ext


What command can you use from a command prompt to convert the FAT32 drive D to a NTFS drive?

type "diskpart" (without the quotes), then type convert d: /fs:ntfs