LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-27-2008, 08:54 PM   #1
oldcarguy85
LQ Newbie
 
Registered: Mar 2008
Posts: 4

Rep: Reputation: 0
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
 
Old 03-27-2008, 09:36 PM   #2
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
sed -n "/x80@/d" /www/logs/access_log
should'nt you not use the '-n' option?
 
Old 03-27-2008, 10:59 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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
 
Old 03-28-2008, 07:03 AM   #4
oldcarguy85
LQ Newbie
 
Registered: Mar 2008
Posts: 4

Original Poster
Rep: Reputation: 0
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
 
Old 03-28-2008, 07:11 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting lines from a file horacioemilio Programming 16 12-18-2007 06:07 PM
deleting even numbered lines bharatbsharma Programming 7 11-26-2007 05:34 AM
deleting specified lines in a huge text file ruh31 Linux - General 10 06-30-2006 03:34 AM
awk/gawk/sed - read lines from file1, comment out or delete matching lines in file2 rascal84 Linux - General 1 05-24-2006 09:19 AM
An easy way of deleting lines from multipe files? delawhere Linux - General 2 04-02-2004 11:58 AM


All times are GMT -5. The time now is 07:00 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration