Unix Shell - is this possible?<file processing>

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > August 2007 > is this possible?<file processing>





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author is this possible?<file processing>
DriVE_mE_cRazY

2007-08-30, 7:20 am

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 help????


regards,
senthil

pgas

2007-08-30, 7:20 am

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 help????
>
> regards,
> senthil



sed -n '/Filelist/,/endof Fileslist/p' patch.log > usefull.log

replytoshishir@gmail.com

2007-08-31, 7:17 am

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 help????
>
> 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

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com