New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
I found one guys
cat file | egrep -v "^\s*(#|;|$)"
Hope it helps someone
@Zen
Can someone tell me how to create an alias for the command above
No need to use cat.
egrep -v "^\s*(#|;|$)" <file>
If you use bash, add this to .bashrc:
ncom () { egrep -v "^\s*(#|;|$)" $1; }
to create alias "ncom" for the command above.
echo 'newcommand() { cat "$@" | egrep -v "^\s*(#|;|$)" ;}' >> ~/.bashrc
And run the command like this
newcommand file
@aus
I added it to bashrc but i still get newcommand not found
Type
bash
and it should take effect.you can use multiple -e statements. makes it easier to read.
also filters empty lines...
With yesterday's discovery this phrase gets a completely new meaning :-D
@aus thanks it worked
@alessio a patch for bash has already been issued