Prints a file leaving out all blank lines and comment-only lines

egrep -v "^\s*(#|$)" myfile.cfg
Does not print any line that either: - is empty - contains only spaces or tabs - starts with # - starts with spaces/tabs followed by a #

2
By: dan
2011-12-08 15:25:17

What Others Think

You got your useless cat award. Congratulations
zolden · 582 weeks and 5 days ago
This, instead of dumping only lines containing only whitespace, will dump lines containing only "s". Probably not real useful, but you never know. :-)
trapperb · 582 weeks and 5 days ago
Might be useful for boring configs with lots of comments, but as pointed above it needs backslash before that s because, currently it does NOT do what description says.
mwgamera · 582 weeks and 2 days ago
For some reason the backslash does not show up. Here's the command: cat boring.conf | egrep -v "^\s*(#|$)"
dan · 582 weeks and 1 day ago
Or: egrep -v "^\s*(#|$)" boring.conf No need for cat(1).
atoponce · 581 weeks and 2 days ago
Thanks @atoponce, much better. I've modified the command.
dan · 580 weeks and 6 days ago
Extremely helpful post. This is my first time i visit here. I discovered such a large number of intriguing stuff in your blog particularly its exchange. Truly its extraordinary article. Keep it up. N95 mask
jackson2321 · 79 weeks and 2 days ago
You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. ??
jackson2321 · 78 weeks and 6 days ago
Your source for the wholesale custom water purifier, air purifier, water hydrogen machine at a competitive price. Purificador de ar de Olansi
KayGasaway · 78 weeks and 6 days ago
Impressive web site, Distinguished feedback that I can tackle. Im moving forward and may apply to my current job as a pet sitter, which is very enjoyable, but I need to additional expand. Regards. Pi Email
KayGasaway · 78 weeks and 1 day ago
This is certainly hence attractive plus artistic. I like a colorations plus whichever company may get them while in the mailbox might be smiling. http://www.wireonelogin.com
KayGasaway · 77 weeks and 3 days ago
It's great that you have the urge to help students like me. Keep it up. Irvine Concrete Pros
OwenThatcher · 76 weeks and 1 day ago
Thanks for taking the time to discuss that, I feel strongly about this and so really like getting to know more on this kind of field. Do you mind updating your blog post with additional insight? It should be really useful for all of us. Goldshell lt5 pro for sale
KayGasaway · 75 weeks and 6 days ago
Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing site de streaming
KayGasaway · 75 weeks and 4 days ago
Very efficiently written information. It will be beneficial to anybody who utilizes it, including me. Keep up the good work. For sure i will check out more posts. This site seems to get a good amount of visitors. ?????????????
KayGasaway · 75 weeks and 2 days ago
Your article is extremely helpful exceptionally fascinating subject i am looking that sort of post thank for imparting to us keep it up. ???????
KayGasaway · 74 weeks and 4 days ago
enamel badges made to order, Badge Creation make all types of badges and lapel pins, enamel and printed. Call us on 0845 299 6550 https://www.badgecreation.co.uk
KayGasaway · 72 weeks and 4 days ago
I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... ???????????
jackson2321 · 72 weeks and 3 days ago
This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: Autolikes
KayGasaway · 72 weeks and 3 days ago
If you are looking for more information about flat rate locksmith Las Vegas check that right away. Hochschule Hamm Lippstadt
Joshua4524 · 71 weeks and 5 days ago
Great article Lot's of information to Read...Great Man Keep Posting and update to People..Thanks https://okimdir.az/xeber/sahil-babayevin-ailesi/
hanry · 71 weeks and 3 days ago
I really like your blog. Great article. It's most evident, people should learn before they are able to http://www.filefactory.com/file/2rgg62nqv2yc/Benefits_associated%20with%20Vaping%20That%20you%20may%20Love.docx">thc wax
jackson2321 · 71 weeks and 2 days ago
You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. visit the site
jackson2321 · 70 weeks and 3 days ago
We are truly thankful for your blog entry. You will discover a great deal of methodologies in the wake of going to your post. I was precisely scanning for. A debt of gratitude is in order for such post and please keep it up.  Fun88
jackson2321 · 70 weeks and 1 day ago
First You got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks. thc dabs for sale
jackson2321 · 70 weeks and 1 day ago
This is my first time visit here. From the tons of comments on your articles,I guess I am not only one having all the enjoyment right here! "e?cinsel Filmleri izle":https://siyahfilmizle.net/filmizle/gay-film/
hanry · 69 weeks and 3 days ago
Thanks for your insight for your fantastic posting. I’m glad I have taken the time to see this. https://topuniversitieslist.com/yichun-university/
hanry · 69 weeks and 1 day ago
En nuestra web puedes encontrar pisos baratos donde entrar a vivir, te asesoraremos en todo lo que necesites. Terreno en venta en tenerife
hanry · 69 weeks ago
Shanghai Pamaens Technology Co., Ltd specializes in the R&D, production and sales of energy-saving heating and insulation products, training and after-sale one-stop service. Infrared ceramic heater
hanry · 69 weeks ago
Watchessy is a OEM & ODM watches manufacturer & supplier in China which can provide watches wholesale. We are your one-stop-shop solution to custom watch design,watch manufacturing and Watch necessaries(box,tag ,booklet,watch tool and so on). We also make private label watches based on customer's design or idea.Our designer will draw the engineering file and picture for you to check . And we can provide the necessary certificates like CE,Rohs which our customer require. We have our own factory,production and assembly with 10 years watch experience.Swiss Ronda,Japanese Miyota,Seiko movement is our watch movement supplier. Our warranty is at least one year. wholesale watches
hanry · 69 weeks ago
Extremely pleasant article, I appreciated perusing your post, exceptionally decent share, I need to twit this to my adherents. Much appreciated!.  check that
jackson2321 · 68 weeks and 4 days ago
If you don"t mind proceed with this extraordinary work and I anticipate a greater amount of your magnificent blog entries.  buy thc oil online
jackson2321 · 68 weeks and 4 days ago
Most of the time I don’t make comments on websites, but I'd like to say that this article really forced me to do so. Really nice post! ????? mm88
jackson2321 · 68 weeks and 1 day ago
I think this is definitely an amazing project here. So much good will be coming from this project. The ideas and the work behind this will pay off so much. ?????
jackson2321 · 68 weeks ago
I really like your blog. Great article. It's most evident, people should learn before they are able to ?????
jackson2321 · 67 weeks and 6 days ago
Hi there, I found your blog via Google while searching for such kinda informative post and your post looks very interesting for me. Canninghill Piers
jackson2321 · 67 weeks and 6 days ago
I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work. chs fairmont
jackson2321 · 67 weeks and 6 days ago
I truly welcome this superb post that you have accommodated us. I guarantee this would be valuable for the vast majority of the general population. ??????
jackson2321 · 67 weeks and 5 days ago
A lot of people having an incorrect image about the cash advance loans or sometimes refer it as bad credit payday loans. ??????????????
jackson2321 · 67 weeks and 5 days ago
Incredible articles and awesome design. Your blog entry merits the greater part of the positive input it"s been getting. ???
jackson2321 · 67 weeks and 4 days ago
Nothing compares to Weber using Genesis sort of grills. That is certainly the type gas grills which have been that will always make sure that they deliver a high performance part of down interval here
jackson2321 · 67 weeks and 4 days ago
I want to say thanks for beautiful blog sharing with us. Your blog really great resource to update my knowledge. cat food flavor enhancers
jackson2321 · 67 weeks and 2 days ago
Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing.  immobilien kaufen
jackson2321 · 67 weeks and 2 days ago
Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing.  youtube smm service
jackson2321 · 66 weeks and 6 days ago
I'm constantly searching on the internet for posts that will help me. Too much is clearly to learn about this. I believe you created good quality items in Functions also. Keep working, congrats! http://korsika.ning.com/profiles/blogs/strategies-for-purchasing-storage-space-containers-for-sale">shipping container for sale
jackson2321 · 66 weeks and 4 days ago
I needed to thank you for this incredible read!! I unquestionably adored each and every piece of it. I have you bookmarked your site to look at the new stuff you post. http://www.authorstream.com/dooseries76/">?????????
jackson2321 · 66 weeks and 4 days ago
I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. http://www.maidoshop.com/anime-pillows/gotoubunnohanayome-c260">?????? ???
Joshua4524 · 66 weeks and 4 days ago
Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though. http://www.maidoshop.com/anime-pillows/gotoubunnohanayome-c260
Joshua4524 · 66 weeks and 4 days ago
Extremely pleasant article, I appreciated perusing your post, exceptionally decent share, I need to twit this to my adherents. Much appreciated!.  Best Smm Panel
jackson2321 · 66 weeks and 3 days ago
A debt of gratitude is in order for sharing the information, keep doing awesome... I truly delighted in investigating your site. great asset... Infinite Income Plan Review
seomind · 63 weeks and 6 days ago
Personally I think overjoyed I discovered the blogs. Infinite Income Plan Review
seomind · 63 weeks and 6 days ago
so happy to find good place to many here in the post, the writing is just great, thanks for the post. scamrisk
seomind · 63 weeks and 6 days ago
Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. scamrisk
seomind · 63 weeks and 6 days ago
I really enjoyed reading this post, big fan. Keep up the good work andplease tell me when can you publish more articles or where can I read more on the subject? Spare5 Review
seomind · 63 weeks and 6 days ago
I liked your article and I hope you will have many entries or more Spare5 Review
seomind · 63 weeks and 6 days ago
This is also a very good post which I really enjoy reading. It is not everyday that I have the possibility to see something like this. Spare5 Review
seomind · 63 weeks and 6 days ago
I've been looking for info on this topic for a while. I'm happy this one is so great. Keep up the excellent work Spare5 Review
seomind · 63 weeks and 6 days ago
Super site! I am Loving it!! Will return once more, Im taking your food likewise, Thanks. Spare5 Review
seomind · 63 weeks and 6 days ago
I adore your websites way of raising the awareness on your readers. Spare5 Review
seomind · 63 weeks and 6 days ago
If you set out to make me think today; mission accomplished! I really like your writing style and how you express your ideas. Thank you. cairns shipping containers
KayGasaway · 63 weeks and 4 days ago
With the plenty of social media destinations accessible, which ones are best for your business? Cheapest Bitcoin SMM panel for 2022
prostsmm · 53 weeks and 2 days ago
large thumbs up to the great information you could have here within this post. You created some decent points there. You seem to know so much about this topic recherche un film
padon3 · 47 weeks ago
Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under $500 Near Me pug puppies for sale in texas pug puppies for sale $200 pugs for sale near me under $500 pugs for sale under $400 near me pugs for sale near me puppies for sale near me under $500 pug puppies for sale under $1,000 near me pug for sale pug puppies for sale under $300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under $500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale $200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
rahimhh21 · 23 weeks and 5 days ago
I should state just that its magnificent! The blog is instructive and dependably create astonishing things. ???????
merckseo · 19 weeks and 1 day ago
Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under $500 Near Me pug puppies for sale in texas pug puppies for sale $200 pugs for sale near me under $500 pugs for sale under $400 near me pugs for sale near me puppies for sale near me under $500 pug puppies for sale under $1,000 near me pug for sale pug puppies for sale under $300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under $500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies baby pug puppies for sale pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale $200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
Perfecthomepugs · 14 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: