Results 1 to 6 of 6
Hi guys,i got this problem which is..i need to find those sentences with date inside and extract them out,the input is somehow like this
eg:
$DATA42.GANTRY2.GA161147 DISKFILE 2007-10-16 11:56:45 SUPER.OPR ...
- 10-30-2007 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 25
How to find Date format and extract line??
Hi guys,i got this problem which is..i need to find those sentences with date inside and extract them out,the input is somehow like this
eg:
$DATA42.GANTRY2.GA161147 DISKFILE 2007-10-16 11:56:45 SUPER.OPR \NETS.$Y4CB.#IN
\NETS.4,246
F DENIED READ
Report date range........: 2007-08-01 00:00 to 2007-08-01 23:59
Subject System...........: *
Subject Userid...........: *.*
Subject Login Name.......: *
Subject Terminal.........: *
Operation................: *
so what i need is the one with the date format (yyyy/mm/dd):
$DATA42.GANTRY2.GA161147 DISKFILE 2007-10-16
this line will be printed..can this be done using sed or awk????
- 10-30-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Something went wrong see below:
- 10-30-2007 #3Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Try this, it prints the 3th field of the line if the first field match with the regexp:
RegardsCode:awk '$1 ~ "\$DATA42.GANTRY2.GA161147" {print $3}' file
- 10-31-2007 #4Just Joined!
- Join Date
- Sep 2007
- Posts
- 25
Hi Franklin,well..the above code i post is not only the file that i need to find the sentences,so i was wondering that if sed or awk can find all those sentences with data format and extract them?Is there anyway to do it?
- 10-31-2007 #5Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Not really clear for me what you're trying to achieve.
Can you provide further information e.g. the format of the file and the expected output.
Regards
- 10-31-2007 #6Just Joined!
- Join Date
- Sep 2007
- Posts
- 25
hey franklin,thanks for replying,i found the answer le,but thanks to your previous code also,thanks alot!


Reply With Quote