Printing unique lines in the Linux
Recently I have begun to use with Linux. Well it’s a great operating system. If there 10 lines in the files how will I print the unique line from that file. I don’t require to similar line on the screen. I am here because many of you are familiar with the Linux. I thought I will definitely get solution from you. If you have any suggestion please let me know. I will be really thankful to you. Please tell me appropriate solution as soon as possible.
Re: Printing unique lines in the Linux
Well looking at your situation I am suggesting you to use grep command. This command is used for searching of the text in the file. You can provide every single line of the file to the command. It will count the total number of similar line the file. If the total count is one then it will echo the line on the screen. I think grep command will definitely solve your problem. Thanking you for the reading the solution.
Re: Printing unique lines in the Linux
I am suggesting you to use Sort command to get the appropriate results. ‘sort’ command sorts the line according to argument list provided. You have to use the following code sort <file> | uniq. ‘sort’ will sort the file and ‘uniq’ command will extract t unique line from the file. It is another great solution for you. If it does not working for you can follow other forums also on the internet. Try your Luck!. It may help you.
Re: Printing unique lines in the Linux
You can use ‘sort’ command in more efficient manner as below. Type following command on the terminal sort –u somefile | lpr’. You have to sort the file and the desired output is redirected to lpr. On above example somefile is source file and the lpr is the destination file where output is redirected. I want to say thank you to all of you for replying and suggesting idea on this matter. I really want to appreciate your efforts that you have put in.