|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi all,
I'm a DBA with not much scripting knowledge.I have a situation like this. there is a log file call patch.log which has some useful information for me like for eg: ############################# ############################# USELESSINFORMATION ############################# ############################# ******Filelist starts here************* useful information useful information ******endof Filelist****************** ############################# ############################# USELESSINFORMATION ############################# ############################# ******Filelist starts here************* useful information useful information ******endof Filelist****************** like this it goes on. My requirement is it possible to write a shell script which reads the patch.log file and extract the useful information which was there in the log file... means take only the block of the useful information present here and there in the log file... and generate a new file wit all these infrmation dumped?.All the useful information starts with the keyword "Filelist" and ends with "endof Fileslist".Please can any one ???? regards, senthil |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Aug 30, 9:45 am, DriVE_mE_cRazY <k.senthilmuru...@gmail.com> wrote:
> Hi all, > > I'm a DBA with not much scripting knowledge.I have a situation like > this. > > there is a log file call patch.log which has some useful information > for me like for eg: > > ############################# > ############################# > USELESSINFORMATION > ############################# > ############################# > ******Filelist starts here************* > useful information > useful information > ******endof Filelist****************** > ############################# > ############################# > USELESSINFORMATION > ############################# > ############################# > ******Filelist starts here************* > useful information > useful information > ******endof Filelist****************** > like this it goes on. > > My requirement is it possible to write a shell script which reads the > patch.log file and extract the useful information which was there in > the log file... means take only the block of the useful information > present here and there in the log file... and generate a new file wit > all these infrmation dumped?.All the useful information starts with > the keyword "Filelist" and ends with "endof Fileslist".Please can any > one ???? > > regards, > senthil sed -n '/Filelist/,/endof Fileslist/p' patch.log > usefull.log |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Aug 30, 11:45 am, DriVE_mE_cRazY <k.senthilmuru...@gmail.com>
wrote: > Hi all, > > I'm a DBA with not much scripting knowledge.I have a situation like > this. > > there is a log file call patch.log which has some useful information > for me like for eg: > > ############################# > ############################# > USELESSINFORMATION > ############################# > ############################# > ******Filelist starts here************* > useful information > useful information > ******endof Filelist****************** > ############################# > ############################# > USELESSINFORMATION > ############################# > ############################# > ******Filelist starts here************* > useful information > useful information > ******endof Filelist****************** > like this it goes on. > > My requirement is it possible to write a shell script which reads the > patch.log file and extract the useful information which was there in > the log file... means take only the block of the useful information > present here and there in the log file... and generate a new file wit > all these infrmation dumped?.All the useful information starts with > the keyword "Filelist" and ends with "endof Fileslist".Please can any > one ???? > > regards, > senthil ofcorse it is possible but i would like to know more about it.. can a useless line also start with the "Filelist" keyword if not then the following command can be useful for you the cat patch.log | sed -n 'Filelist/,/endof Filelist/p' >> newfile this will contain 2 extra line i.e containing containing "***********Filelist start here*******************" and "******************endof Filelist******************" to avoid this u can use this command provided none of the lines in between the section contains the keyword "Filelist" cat patch.log | sed -n 'Filelist/,/endof Filelist/p' | grep -v "Filelist" >> newfile thanks & regards Shishir srivastava |
|
![]() |
| Outils de la discussion | |
|
|