LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2006, 10:15 AM   #1
PirateJack
LQ Newbie
 
Registered: Aug 2005
Location: London, England
Distribution: RHEL3
Posts: 20

Rep: Reputation: 0
processing data within files


I have some squid log files that I am feeding into an app. for analysis.

The log files contain one line entries like syslog, and due to the way I've got the authentication set up, every session first pops up a TCP_DENY entry on the log.

What I want to do is purge my log files of any lines which contain the text 'TCP_DENY'

Anyone know a nice elegant way to do this? I have a feeling grep is the answer but I don't know how to get it doing what I want and my google search has been fruitless!

I've got a script set up which is run by cron daily, that rotates my logs and zips them up and ftps them off to a remote server, I'd like to include the TCP_DENY purge as part of that script.

Any help appreciated!
 
Old 03-28-2006, 10:27 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

cat logfile | grep -v "TCP_DENY"

Something like the above showes all but lines with TCP_DENY.

Hope this helps.

And here's one using sed:

sed -n '/TCP_DENY/!p' logfile

Last edited by druuna; 03-28-2006 at 10:29 AM.
 
Old 03-28-2006, 10:29 AM   #3
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
grep -v TCP_DENY squid.log > squid-modified.log
 
Old 03-28-2006, 11:32 AM   #4
PirateJack
LQ Newbie
 
Registered: Aug 2005
Location: London, England
Distribution: RHEL3
Posts: 20

Original Poster
Rep: Reputation: 0
Talking

Did the job perfectly, thanks folks :-)
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Processing joelhop Linux - General 8 01-01-2006 09:08 PM
Data Processing Server peter72 Linux - Software 1 06-14-2005 12:17 PM
rpm hangs while reading/processing headers after a forced removing of files hamtavs Linux - Software 0 08-25-2004 03:14 PM
need help on processing large data files eph Programming 3 03-11-2004 05:56 AM
saving files after sed processing raypen Linux - General 2 07-23-2002 07:38 AM


All times are GMT -5. The time now is 12:52 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration