Good Day,
I would like to put a "query" script to a logfile from cron which is run scheduled on a certain day.
lets's say we have a logfile containing some data from Feb 21st to Feb 24th and I want to run a script that copies the content from Feb22 to Feb 24 into a new file
cat logfile
Feb 21
nmxcvc
Feb 22
jvjhkcvlv
kljjksdjl
Feb 23
kkfgooo
jjfgjhkgc
Feb 24
jsdjfjsdf
so the desired output would look like this
Feb 22
jvjhkcvlv
kljjksdjl
Feb 23
kkfgooo
jjfgjhkgc
Feb 24
jsdjfjsdf
I can do this manually using vi but putting this into a script is more complicated.
There was an example of a mygrep (sed -n -e "/$1/p" <$2)
where you give the command i.e mygrep "Feb 22" logfile
where it searches the pattern from the logfile but I would like to extend this
from that date to the end of that file and direct the output into a newfile.
Any help on this?
#Kimmers
I would like to put a "query" script to a logfile from cron which is run scheduled on a certain day.
lets's say we have a logfile containing some data from Feb 21st to Feb 24th and I want to run a script that copies the content from Feb22 to Feb 24 into a new file
cat logfile
Feb 21
nmxcvc
Feb 22
jvjhkcvlv
kljjksdjl
Feb 23
kkfgooo
jjfgjhkgc
Feb 24
jsdjfjsdf
so the desired output would look like this
Feb 22
jvjhkcvlv
kljjksdjl
Feb 23
kkfgooo
jjfgjhkgc
Feb 24
jsdjfjsdf
I can do this manually using vi but putting this into a script is more complicated.
There was an example of a mygrep (sed -n -e "/$1/p" <$2)
where you give the command i.e mygrep "Feb 22" logfile
where it searches the pattern from the logfile but I would like to extend this
from that date to the end of that file and direct the output into a newfile.
Any help on this?
#Kimmers