![]() |
|
|
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 |
| Text formatting question | aliaa2a | Shell Programming and Scripting | 7 | 05-24-2008 08:27 AM |
| TOP Results AIX 5.3 | mcastill66 | AIX | 1 | 09-26-2005 01:54 PM |
| Multiple Grep Results - Formatting | sysera | Shell Programming and Scripting | 7 | 03-25-2004 06:04 AM |
| set -A RESULTS | Ashishm | Shell Programming and Scripting | 2 | 04-08-2002 01:26 PM |
| disk formatting question | 98_1LE | UNIX for Dummies Questions & Answers | 1 | 01-09-2001 11:49 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Question about formatting results
OK, I have a command that is getting a result, that I am trying to format using awk. I think it's pretty ugly, and there is probably a better way to do it, but this is sorta working for me. Anyway, the command: Code:
cat /var/log/cups/page_log | grep testuser | grep My_office_printer | awk '{gsub ("\\[", ""); print $4}' | awk '{gsub (":", "/"); print}' | awk -F/ '{print $2, $1, $3}'
(FYI, this is just getting a list of all dates that testuser printed to My_office_printer. The unformatted line would look like this, so you can see why I have all those awks in there: Code:
My_office_printer testuser 4 [09/Jun/2004:15:05:57 -0400] 2 1 - localhost Will return this: Code:
Jan 03 2005 Jan 03 2005 Jan 03 2005 Jan 03 2005 Jan 03 2005 Jan 03 2005 Jan 03 2005 Jan 03 2005 Jan 03 2005 Jan 05 2005 Jan 05 2005 I want to reduce this to one entry per date, showing the number of entries there were. For example: Code:
Jan 03 2005 had 8 print jobs Jan 05 2005 had 2 print jobs Thanks in for everyone who has helped with all my noob questions |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|