awk & date time format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk & date time format
# 1  
Old 12-16-2010
awk & date time format

This gives:
Code:
grep "qprt  -o -dp -N 1 -P" printfile.log.1216 |awk '{print $7, $9}' |grep lpc1z

The output like below:
Code:
lpc1z /cerner/d_prod/print/ccltemp4235396d030a.dat.tmp.1216075330]
lpc1z /cerner/d_prod/print/ccltemp4235396d036a.dat.tmp.1216075634]
lpc1z /cerner/d_prod/print/ccltemp4235396d038a.dat.tmp.1216075721]
lpc1z /cerner/d_prod/print/ccltemp4235396d056a.dat.tmp.1216080939]

What I am trying to do is:
Code:
grep "qprt  -o -dp -N 1 -P" printfile.log.1216 |awk '{print $7, $9}' |grep lpc1z |awk '{print $1, and_something_for_date_time}'

1216075330 is the timestamp, 12-16 07:53:30

so that, it can give me:
Code:
lpc1z  12-16 07:53:30
lpc1z  12-16 07:56:34
lpc1z  12-16 07:57:21

Please advise

Last edited by Scott; 12-16-2010 at 04:30 PM.. Reason: Code tags, please...
# 2  
Old 12-16-2010
Code:
 
grep "qprt -o -dp -N 1 -P" printfile.log.1216 |awk '{print $7, $9}' |grep lpc1z | sed 's#^\([^ ]*\).*\.\(..\)\(..\)\(..\)\(..\)\(..\)]$#\1 \2-\3 \4:\5:\6#'

# 3  
Old 12-16-2010
Thank you so much. That works fine!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

DATE and TIME format help in HP-UX

Hello, I have date format as shown in red color below Fri, Sep 12, 2012 08:38:05 PM Can anyone help me with command to change this format to yyyy-mm-dd and HH:MM:SS Note: Time should be in 24 hours format I really appreciate your help!! Thanks, Elavarasan (4 Replies)
Discussion started by: Elavarasan
4 Replies

2. Shell Programming and Scripting

Using awk or nawk to convert epoch time to date format

Looking for some help and usually when I do a search this site comes up. Hopefully someone can give me a little direction as to how to use one of these two commands to achieve what I'm trying to do. What am I trying to do? I need to take the time value in epoch format returned from the... (5 Replies)
Discussion started by: minigts
5 Replies

3. UNIX for Dummies Questions & Answers

Shell Scripts - shows today’s date and time in a better format than ‘date’ (Uses positional paramete

Hello, I am trying to show today's date and time in a better format than ‘date' (Using positional parameters). I found a command mktime and am wondering if this is the best command to use or will this also show me the time elapse since 1/30/70? Any help would be greatly appreciated, Thanks... (3 Replies)
Discussion started by: citizencro
3 Replies

4. Programming

DATE & TIme

Can we select the datetime from oracle database in “hhmmssnnnccyymmdd” format ? please help to solve this..... (2 Replies)
Discussion started by: Sanal
2 Replies

5. Shell Programming and Scripting

Convert epoch to human readable date & time format

Hello I have log file from solaris system which has date field converted by Java application using System.currentTimeMillis() function, example is 1280943608380 which equivalent to GMT: Wed, 04 Aug 2010 17:40:08 GMT. Now I need a function in shell script which will convert 1280943608380... (3 Replies)
Discussion started by: Yaminib
3 Replies

6. Shell Programming and Scripting

date and time in mm/dd/yyyy hh:mm format

Frens, I have a logfile which has got manier things in it and somewer in that file i have a date in mm/dd/yyyy hh:mm format.... I just need to get the date and time nothing else.... i have searched in this forum for it but got only date in mm-dd-yyyy format.. but i need to search for... (10 Replies)
Discussion started by: smarty86
10 Replies

7. Shell Programming and Scripting

Date and Time format

I want to append current date and time to a file name like filename_090920091210. If I use filename_`date +%d%m%Y%T`, the ouput is filename_0909200912:10:33. How to format this as filename_090920091210. Please let me know. Thanks in advance. (3 Replies)
Discussion started by: srimenon09
3 Replies

8. Shell Programming and Scripting

Convert Epoch Time to Standard Date and Time & Vice Versa

Hi guys, I know that this topic has been discuss numerous times, and I have search the net and this forum for it. However, non able to address the problem I faced so far. I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies

9. Shell Programming and Scripting

Convert Epoch time format to normal date time format in the same file

I have a file named "suspected" with series of line like these : {'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''} {'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Discussion started by: rk4k
3 Replies

10. Shell Programming and Scripting

format date/time presentation

1) i am trying to print the timeframe of a log file using the start/end date/time being extracted from the file itself. my problem is how to convert the following numeric date format to the one that i prefer: Start time: 0204161129 End time : 0204171431 into: Start time: Apr 16 2002... (6 Replies)
Discussion started by: apalex
6 Replies
Login or Register to Ask a Question