The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
reading lines c0mrade Shell Programming and Scripting 4 05-17-2008 01:22 PM
reading lines in pairs from file in ksh ytokar Shell Programming and Scripting 4 02-08-2008 11:50 AM
Reading lines in a file matching a pattern torenji Shell Programming and Scripting 4 10-25-2007 01:15 AM
Reading lines within vi editor asriva26 Shell Programming and Scripting 2 08-30-2006 06:47 AM
Reading lines within a Unix file. mariner UNIX for Advanced & Expert Users 5 11-18-2003 10:26 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 02-24-2007
Registered User
 

Join Date: Nov 2003
Posts: 2
skip reading certain lines in a file

How can I exclude reading lines in a file that contains the following:

filesystem:/home/pach/liv_patches 128005120 88456640 37270758 71% /home/patches

That is, all lines that contain and begins with filesystem: should not be processed/read from a file
Reply With Quote
Forum Sponsor
  #2  
Old 02-24-2007
Registered User
 

Join Date: Feb 2006
Location: Schenectady, NY
Posts: 130
sed -e "/^filesystem:/d" filename

or

grep -v "^filesystem:" filename
Reply With Quote
  #3  
Old 03-25-2007
Registered User
 

Join Date: Mar 2007
Location: Bangalore,India
Posts: 8
Cool

Hi hagemaro,

I think your solution will only serve the purpose when the word "filesystem" is at the begining.

Please correct if i am wrong.

Cheers
Reply With Quote
  #4  
Old 03-25-2007
dj -------
 

Join Date: Feb 2007
Location: Cochin/Bangalore, India
Posts: 418
Try this out... This will not show any lines containing the specified word.

Code:
 sed '/filesystem/d' filename

grep 'filesystem' filename
Reply With Quote
  #5  
Old 03-25-2007
Registered User
 

Join Date: Sep 2006
Posts: 1,580
Quote:
Originally Posted by jacoden
Try this out... This will not show any lines containing the specified word.

Code:
 sed '/filesystem/d' filename

grep 'filesystem' filename
user wants to exclude lines with "filesystem", so the grep should have -v? anyway, i noticed this thread was started weeks ago.
Reply With Quote
  #6  
Old 03-26-2007
dj -------
 

Join Date: Feb 2007
Location: Cochin/Bangalore, India
Posts: 418
Quote:
Originally Posted by ghostdog74
user wants to exclude lines with "filesystem", so the grep should have -v? anyway, i noticed this thread was started weeks ago.
Sorry ..it was a typo.. It should be grep -v ...
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0