getting date from timestamp



Hi All,

i have a time stamp. from that i am trying to awk to get the year,
month and date.

TIME=20060614092446

DESIRED OUTPUT: 20060614

i am doing the following;

TIME=20060614092446
$ TimeStarted=`expr match '$TIME' '.*\(......\)'`
echo $TimeStarted

i am not getting any output. can anyone please suggest me.

thanks
mark

.



Relevant Pages

  • Re: Date from the time stamp
    ... i have a time stamp. ... from that i am trying to awk to get the year, ... DESIRED OUTPUT: 20060614 ... Shell Scripting Recipes: ...
    (comp.unix.shell)
  • Re: Subtraction with awk
    ... I am fairly new to awk & sed and was hoping I could get a bit of help with this issue. ... #desired output>> timestamp.log ... then email then append it to the timestamp.log and email (the append ... I have been told that this can be done in perl but I was ...
    (comp.lang.awk)
  • Re: getting date from timestamp
    ... from that i am trying to awk to get the year, ... DESIRED OUTPUT: 20060614 ... Single quotes prevent variable expansion, ...
    (comp.unix.programmer)
  • Combine consecutive lines with identical keys
    ... I am very new to using awk. ... file which has been sorted on key fields, ... identical keys without duplicating the key information. ... The desired output is: ...
    (comp.lang.awk)
  • Newbie: print values from several rows on one line
    ... I have got a problem that I have got a feeling that awk can solve. ... data are printed on one line with brackets around them if column 1 is the ... Desired output: ...
    (comp.unix.shell)