Just delete the line from access.log: We’ve one file called
access.log with below mention data/line.
Command:
sed -i '/\/five-5-success-factor.html/d' access.log
access.log:
Hello tutorialbyexample, home page access by GET http://www.tutorialbyexample.com/
success HTTP 200
This is the success page of five success by POST http://www.tutorialbyexample.com/2015/09/five-5-success-factor.html
HTTP 200
Hello tutorialbyexample, home page access by GET http://www.tutorialbyexample.com/
success HTTP 200
This is the success page of five success by POST http://www.tutorialbyexample.com/2015/09/five-5-success-factor.html
HTTP 200
Hello tutorialbyexample, home page access by GET http://www.tutorialbyexample.com/
This is the success page of five success by POST http://www.tutorialbyexample.com/2015/09/five-5-success-factor.html
Hello tutorialbyexample, home page access by GET http://www.tutorialbyexample.com/
Output in same file
access.log:
Hello tutorialbyexample, home page access by GET http://www.tutorialbyexample.com/
success HTTP 200
Hello tutorialbyexample, home page access by GET http://www.tutorialbyexample.com/
success HTTP 200
Hello tutorialbyexample, home page access by GET http://www.tutorialbyexample.com/
Hello tutorialbyexample, home page access by GET http://www.tutorialbyexample.com/
Command explanation:
sed -i '/\/five-5-success-factor.html/d' access.log
sed –i option will replace in same file. It will open for
manipulations and write it in same file.
“/five-5-success-factor.html” this is the actual data want
to find but we can’t use / as data so just added escape char \ for considering
/ as data.
And it consider as “\/five-5-success-factor.html” for
finding the string.
No comments:
Post a comment
Please provide your input, it will honer for me...