The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk, ignore first x number of lines. trey85stang Shell Programming and Scripting 8 05-21-2008 05:44 AM
Ignore some lines with specific words from file comparison jakSun8 Shell Programming and Scripting 2 03-13-2008 12:11 AM
Ignore Lines Begining With # sysera Shell Programming and Scripting 4 08-23-2005 10:04 AM
Make sed ignore lines Scarlos Shell Programming and Scripting 2 07-21-2005 11:33 AM
Removing duplicate lines ignore case hellsd UNIX for Dummies Questions & Answers 17 12-02-2004 10:47 AM

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-30-2006
csaha's Avatar
csaha csaha is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 81
How can I ignore only the lines which have # at the begining?

From the below file I want to grep only the lines except the comment sections. But grep -v "#" is eliminating the last line because it has one # in between.

Any idea how can I ignore only the lines which have # at the begining (I mean comment lines) ?

Quote:
$ cat /etc/fstab

# This is the FSTAB file
# Do not edit this file
/dev/sda3 / reiserfs defaults 1 1
/dev/sda1 /boot reiserfs defaults 1 2
/dev/sdb1 /home reiserfs defaults 1 2
/dev/sda2 swap swap pri=42 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
proc /proc proc defaults 0 0
usbdevfs /proc/bus/usb usbdevfs noauto 0 0
/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0
/dev/fd0 /media/floppy auto noauto,user,sync 0 0
//drowzee/ISW /SW smbfs auto,username=xsiam,password=wrinkle#B52 0 0
Thanks a lot to all in advance
C Saha
  #2 (permalink)  
Old 01-30-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
grep -v '^#'
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 07:36 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