The UNIX and Linux Forums  


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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #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