The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Splitting input files into multiple files through AWK command arund_01 Shell Programming and Scripting 3 05-13-2008 09:17 AM
Find duplicates from multuple files with 2 diff types of files ricky007 Shell Programming and Scripting 2 03-04-2008 01:46 PM
unzip particular gzip files among the normal data files thepurple Shell Programming and Scripting 4 11-30-2007 11:17 AM
when I try to run rm on multiple files I have problem to delete files with space umen UNIX for Dummies Questions & Answers 1 09-20-2005 03:20 AM
text files, ASCII files, binary files and ftp transfers Perderabo Answers to Frequently Asked Questions 0 04-08-2004 04:25 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-07-2008
mp3catcer1 mp3catcer1 is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 3
Log files

Hello,

I want to delete a logfile but not all the message in the log;

example,

wait
wait
wait
wait
hello
hello
hello
hello

so in the logfile i will delete only the text hello and the wait not.
  #2 (permalink)  
Old 01-07-2008
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
grep -i wait /somepath/yourlogfile > /tmp/your-tmp-logfile
mv /tmp/your-tmp-logfile /somepath/yourlogfile

You may want to check ownership/permissions on the log file before and after to insure it's the same. If the log file is opened by a process, you may want to stop it before changing it (since you didn't really state what the log file is for... )
  #3 (permalink)  
Old 01-08-2008
mp3catcer1 mp3catcer1 is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 3
Quote:
Originally Posted by RTM View Post
grep -i wait /somepath/yourlogfile > /tmp/your-tmp-logfile
mv /tmp/your-tmp-logfile /somepath/yourlogfile

You may want to check ownership/permissions on the log file before and after to insure it's the same. If the log file is opened by a process, you may want to stop it before changing it (since you didn't really state what the log file is for... )
Thanks but this not where i`m looking for what i meen is a log file in that log file are serverall types of information and ill will only delete som wait or what i said. Example log file:
wait (Delete)
wait (Delete)
wait (Delete)
wait (Delete)
close (stay)
close (stay)
wait (Delete)
wait (Delete)

So only the wait errors delete
  #4 (permalink)  
Old 01-08-2008
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Then replace the -i option with -iv
grep -iv wait /somepath/yourlogfile > /tmp/your-tmp-logfile
mv /tmp/your-tmp-logfile /somepath/yourlogfile

This will change grep to get everything except lines with wait in them
  #5 (permalink)  
Old 01-09-2008
mp3catcer1 mp3catcer1 is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 3
Quote:
Originally Posted by RTM View Post
Then replace the -i option with -iv
grep -iv wait /somepath/yourlogfile > /tmp/your-tmp-logfile
mv /tmp/your-tmp-logfile /somepath/yourlogfile

This will change grep to get everything except lines with wait in them

Thkx this works for my self i`l got almost the same:
grep -v "^Wait$" file > file; mv file
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:55 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0