I want to grep smb.conf and see only lines which are not commented.
grep "^[^#;]" smb.conf
The first ^ refers to the beginning of the line, so lines with comments starting after the first character will not be excluded. [^#;] means any character which is not # or ;.
cat /etc/samba/smb.conf | grep ^[^#\;]
grep -v "^ *\(#.*\|\)$" < smb.conf
cat file | grep "blah"
grep "blah" <file
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
2 years ago