Go Back   TechArena Community > Software > Operating Systems
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Printing unique lines in the Linux

Operating Systems


Reply
 
Thread Tools Search this Thread
  #1  
Old 26-12-2010
Member
 
Join Date: Dec 2010
Posts: 299
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.

Reply With Quote
  #2  
Old 26-12-2010
Member
 
Join Date: May 2008
Posts: 962
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.
Reply With Quote
  #3  
Old 26-12-2010
Member
 
Join Date: May 2008
Posts: 1,020
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.
Reply With Quote
  #4  
Old 26-12-2010
Member
 
Join Date: Nov 2009
Posts: 823
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.
Reply With Quote
Reply

  TechArena Community > Software > Operating Systems
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Printing unique lines in the Linux"
Thread Thread Starter Forum Replies Last Post
What is unique about the Linux Kavanagh Operating Systems 4 06-02-2012 08:31 PM
Unable to open printing preferences while printing from Dell Inkjet Photo Printer 720 LaurenBc Portable Devices 2 11-11-2011 05:54 PM
Printing MPP files to Adobe and then printing on paper mbbackus Microsoft Project 2 28-09-2011 06:10 PM
Printing With Lexmark X5320 connected with Linux Mint 10 NamJam Portable Devices 3 02-01-2011 07:17 AM
SQL UNIQUE and DISTINCT Taarank Software Development 5 10-05-2010 10:40 PM


All times are GMT +5.5. The time now is 03:57 AM.