![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using cp -r command to selectively omit *.dat files while copying a directory. | d_sai_kumar | UNIX for Dummies Questions & Answers | 5 | 07-18-2008 07:48 AM |
| need assistance: sed and repeating patterns | metalwarrior | UNIX for Advanced & Expert Users | 1 | 02-02-2008 05:00 AM |
| Loop through files in dir, omit file with latest date | stringzz | Shell Programming and Scripting | 2 | 12-04-2007 02:04 PM |
| merge 2 files (without repeating any lines) | bluemoon1 | Shell Programming and Scripting | 9 | 10-25-2007 11:31 PM |
| Repeating commands in a script | Dave2874 | Shell Programming and Scripting | 4 | 03-14-2005 10:34 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Omit repeating lines
Can someone help me with the following 2 objectives? 1) The following command is just an example. It gets a list of all print jobs. From there I am trying to extract the printer name. It works with the following command: Code:
lpstat -W "completed" -o | awk -F- '{ print $1}'
Problem is, I want to be able to omit these multiple lines: Code:
My_office_printer My_office_printer My_office_printer My_home_printer My_home_printer So it looks like this: Code:
My_office_printer My_home_printer Now, each line is actually different (because each one is its own print job), but because I use awk to just get the name of the printer, the end result displays the printer name for however many print jobs there were. I just want one instance of each printer name. 2) In the previous section, I want to reduce the number of lines returned to one per printer. Before I do, I want to count how many there are. For example, how many time was My_office_printer listed. Any help is greatly appreciated.... |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|