| Barry Margolin 2006-09-22, 7:01 pm |
| In article <1158881624.265137.220820@k70g2000cwa.googlegroups.com>,
"pawan_test" <sridhara007@gmail.com> wrote:
> 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.
ls -l foo | awk '{sub(":", "", $8); printf("%4s00\n", $8)}'
>
> 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.
Assuming it's in the shell variable $timestamp, use ${timestamp:8}
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
|