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 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 04:22 PM
reading lines in pairs from file in ksh ytokar Shell Programming and Scripting 4 02-08-2008 02:50 PM
Reading lines in a file matching a pattern torenji Shell Programming and Scripting 4 10-25-2007 04:15 AM
Reading lines within vi editor asriva26 Shell Programming and Scripting 2 08-30-2006 09:47 AM
Reading lines within a Unix file. mariner UNIX for Advanced & Expert Users 5 11-18-2003 01:26 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-24-2007
paulsew paulsew is offline
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
  #2 (permalink)  
Old 02-24-2007
hegemaro hegemaro is offline
Registered User
  
 

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

or

grep -v "^filesystem:" filename
  #3 (permalink)  
Old 03-26-2007
bishnu.bhatta bishnu.bhatta is offline
Registered User
  
 

Join Date: Mar 2007
Location: Pune,India
Posts: 12
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
  #4 (permalink)  
Old 03-26-2007
dennis.jacob dennis.jacob is offline Forum Advisor  
dj -------
  
 

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

Code:
 sed '/filesystem/d' filename

grep 'filesystem' filename
  #5 (permalink)  
Old 03-26-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,506
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.
  #6 (permalink)  
Old 03-26-2007
dennis.jacob dennis.jacob is offline Forum Advisor  
dj -------
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 555
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 ...
Sponsored Links
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 10:08 AM.


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