LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Probably a simple sed questions for deleting lines... (https://www.linuxquestions.org/questions/linux-general-1/probably-a-simple-sed-questions-for-deleting-lines-631143/)

oldcarguy85 03-27-2008 08:54 PM

Probably a simple sed questions for deleting lines...
 
Hi there,
I've been reading info on linuxquestions.org for years. Very helpful info here. Here is my first questions!

i am trying to remove several lines of text from our apache log. Actually i'd like to not have to remove these lines (as they shouldn't be there.

216.168.253.199 - - [27/Mar/2008:15:08:01 -0400] "\x80@\x01\x03" 200 18725

that is what the bad lines look like. They screw up awstats when it trie to update. Anyway, i was hoping someone could give me some direction on using sed for this. probably jsut the portion "x80@" could be matched.

this is what i was trying:

sed -n "/x80@/d" /www/logs/access_log

it is not removing the lines for some reason.


Also, from what i understand, these lines are reltaed to some sort of SSL request or something. I'm really not sure why they are there or how to stop apache from logging these bad requests. Any ideas on that would be greatly appreciated.


thanks,
Jordan

konsolebox 03-27-2008 09:36 PM

Quote:

sed -n "/x80@/d" /www/logs/access_log
should'nt you not use the '-n' option?

pixellany 03-27-2008 10:59 PM

sed -n causes nothing to print.
OP says lines are not removed--that's because the file is not written--ie it stays as is.

Need sed -i "stuff" filename
OR
sed "stuff" filename > new filename

oldcarguy85 03-28-2008 07:03 AM

ok great. thanks for the help. I thought -n just made it silent. the problem is, if i let it print al the liens to the screen, it takes FOREVER to run, as the log file gets pretty large pretty fast.

anyway, i'll give -i a try...

thanks,
Jordan

pixellany 03-28-2008 07:11 AM

Yes, -n makes it silent. (That means it doesn't print to the screen or anywhere else--unless you specify a line to print) In your example, you suppressed printing and did not write back to the file. Thus it did nothing.


All times are GMT -5. The time now is 02:52 AM.