capturing the time stamp in desired format


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers capturing the time stamp in desired format
# 1  
Old 09-21-2006
capturing the time stamp in desired format

Hello All,

I am working on korn shell script.i have 2 questions;

1) I have a file and i am able to capture the arrival time.
the arrival time is capturing as 11:30

ls -ltr aaa.bbb.332121312.*.* | awk -F" " '{print $8}'

11:30

my desired output is 113000
can anyone please suggest me how do i do this.

2) I have another question.
I have a timestamp as 20060921094743
my desired output is 094743
can anyone please suggest me how do I only display the last 6 digits
from the timestamp.

Thanks a bunch
mark
# 2  
Old 09-21-2006
Code:
ls -ltr aaa.bbb.332121312.*.* | awk -F" " '{split($8,arr,":"); printf("%s%s00",arr[1],arr[2]);}'

Code:
expr match '20060921094743' '.*\(......\)'

# 3  
Old 09-21-2006
capturing the time stamp

Thanks a lot

mark
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capturing time stamp in file name

I have a file that is created via a perl script where the file is named like so: 01-07-2016_10:17:08. I am running a shell script that needs to take this file and print it. I can capture the date portion fine, but I am unsure how to capture the time stamp, since there will be a difference from what... (1 Reply)
Discussion started by: ldorsey
1 Replies

2. Shell Programming and Scripting

Convert epoch time stamp into human readable format

Can someone help me to write a shell script to convert epoch timestamp into human readable format 1394553600,"test","79799776.0","19073982.728571","77547576.0","18835699.285714" 1394553600,"test1","80156064.0","19191275.014286","62475360.000000","14200554.720000"... (10 Replies)
Discussion started by: Moon1234
10 Replies

3. Shell Programming and Scripting

Desired Date format

I need to get the current year for the files that has been created today. Ex- when i list in unix console it shows ls -l abc.txt -rw-rw-r-- 1 user1 user1 33 May 2 08:58 abc.txt but i need to get as May 2 2013 , i dont need 08:58 is there any command to list it out in that... (7 Replies)
Discussion started by: Prashanth B
7 Replies

4. Shell Programming and Scripting

Need your help to get the output of the list in desired format

Hello Guys, I am working on a script and using the below code to fetch the list of all repositories CHDIR='/mnt/scm/subversion/' repolist() { cd ${CHDIR} Repo=`ls|cut -d " " -f1` echo $Repo } Output of the above code is BSB CIB COB DCI DIB DSB ESB-P ESB-TOOLS FareVerify GCACHE GWY... (15 Replies)
Discussion started by: rohit22hamirpur
15 Replies

5. Shell Programming and Scripting

How to get time duration between two human readable time stamp in Unix?

Here is two time I have: Jul 12 16:02:01 Jul 13 01:02:01 and how can I do a simple match to get difference between two time which is 09:00:00 Thanks in advance. (3 Replies)
Discussion started by: ford99
3 Replies

6. Shell Programming and Scripting

How to get previous 5 min time stamp in hh:mm format ?

Hi All, How to get previous 5 min time stamp in hh:mm format ? suresh (1 Reply)
Discussion started by: suresh3566
1 Replies

7. 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

8. HP-UX

Desired Format !

Hi everybody, I just need desired ouput from text file which should have folowing format; "2007-06-25 00:03:32.926+05:30",12354369,"Load","Completed","Rs.-5,556.00",9452217714 "2007-06-25 00:06:57.357+05:30",12354371,"Load","Completed","Rs.-56.00",9415766266 "2007-06-25... (1 Reply)
Discussion started by: prasanth_babu
1 Replies

9. UNIX for Dummies Questions & Answers

capturing the time stamp to get hours

Hi All, I am working on a korn shell script. I have a problem.i am calculating the next 27 hours from the time stamp. say TSTAMP=20060724000000 if i add 27 hours to the above time stamp, i will get 20060724143000 this is the code: YEAR=`echo $TSTAMP | awk... (0 Replies)
Discussion started by: pavan_test
0 Replies

10. UNIX for Dummies Questions & Answers

capturing the time stamp

Hi All, I am working on a korn shell script. i have a file such as: DS.PETSCO.20060601203514.20060531.ctl_20060717124431 i have 2 problems here. 1) i have to capture the time stamp from the above file i.e this number 20060717124431. format of time stamp is YYYYMMDDHHMMSS. can... (4 Replies)
Discussion started by: pavan_test
4 Replies
Login or Register to Ask a Question