![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| retrive value from a file | satish@123 | Shell Programming and Scripting | 7 | 05-17-2008 05:57 AM |
| retrive lines from a file using AWK command | swamymns | Shell Programming and Scripting | 1 | 05-04-2008 06:47 PM |
| to retrive data that appear only once in a file. | anibu | Shell Programming and Scripting | 1 | 10-26-2007 07:54 AM |
| Retrive deleted file's info | asmita | UNIX for Advanced & Expert Users | 4 | 03-26-2007 10:36 PM |
| Using loop reading a file,retrieving data from data base. | Sonu4lov | Shell Programming and Scripting | 1 | 01-18-2007 11:38 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
help to retrive data from log file
hi
i have following file. where i m trying to retrive data on latest date. let us say we are extracting data from this file for Jun 30 where date is highest date in log file. here i want to take output in other file from first line of Jun 30 to the end of file [ here i want details also like Genration number and genration date] in short i want retrive complete data for the latest date in log file. and latest date is simmilar to the todays date... i m trying to use grep and sub instr but no sucees. plz guide me. Thanks a lot in adavnce Swapneel *****************Thu Jun 28 20:06:28 BST 2006*********************************** *** Generation Number : 20062231 Generation Date : 20060629 There are no detail records *****************Thu Jun 29 23:46:38 BST 2006*********************************** *** Generation Number : 20062231 Generation Date : 20060629 There are no detail records *****************Fri Jun 30 00:01:19 BST 2006*********************************** *** Generation Number : 20062237 Generation Date : 20060629 There are no detail records *****************Fri Jun 30 00:01:19 BST 2006*********************************** *** Generation Number : 20062237 Generation Date : 20060630 There are no detail records |
| Forum Sponsor | ||
|
|
|
|||
|
I think the OP wants all data from Jun 30 :
Code:
#!/bin/ksh
awk '{ if (index($0,"***")>0){
printf("\n%s|",$0)}
else{printf("%s|", $0)}
}' filename | \
grep 'Jun 30' | tr -s '|' '\n' | grep 'Generation'
Code:
tail -5 filename |