The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-23-2005
TheCrunge TheCrunge is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 30
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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0