View only non-comment non-empty lines in a configuration file

grep '^[^#]' squid.conf
grep '^[^#]' sample.conf \__/ |||| \_________/ | |||| | | |||| \- Filename | |||| | |||\- Only character in group is '#' | ||| | ||\- Negate character group (will match any cahracter *not* in the | || group) | || | |\- Start new character group (will match any character in the | | group) | | | \- Match beginning of line | \- Run grep Empty lines will also be not matched, because there has to be at least one non-hash-sign character in the line.
Sample Output
% cat sample.conf
# Option foo

# Opption bar blabla

% grep '^[^#]' sample.conf

By: Flow
2013-02-21 18:51:06

What Others Think

So simple...
Zulu · 488 weeks and 1 day ago
Welcome to my Taobao shop ! Daily update: Discover amazing stuff, collect the things you love, buy it all in one place. novel style, varieties, low price and good quality, and the low sale price ==== ( ) ===== ==== ( ) ===== New to Hong Kong : Winter Dress Best quality, Best reputation , Best services ---**** NHL Jersey Woman $ 40 ---**** NFL Jersey $ 35 ---**** NBA Jersey $ 34 ---**** MLB Jersey $ 35 ---**** Jordan Six Ring_m $ 36 ---**** Air Yeezy_m $ 45 ---**** T-Shirt_m $ 25 ---**** Jacket_m $ 36 ---**** Hoody_m $ 50 ---**** Manicure Set $ 20 ---**** handbag $ 37 ---**** ugg boot $ 43 ---**** give you the unexpected harvest ==== ( ) ===== ==== ( ) ===== ==== ( ) ===== ==== ( ) ===== ==== ( ) =====
wesdfwiusdf · 487 weeks and 5 days ago
grep -v '^#' squid.conf To simple for words!
tonk · 477 weeks and 2 days ago
"grep -v '^#' squid.conf" is not the same as my solution: It also shows empty lines.
Flow · 477 weeks and 2 days ago
Hmm!! This blog is really cool, I’m so lucky that I have reached here and got this awesome information.
muneerahmed · 66 weeks and 3 days ago
There are so many such websites available there that help you to learn the command line languages so easily. This particular vegan diet command is used to view only non comment non empty lines in a configuration file. I am looking here for more details on that and keep up the good work.
Alyssalauren · 61 weeks and 3 days ago
This is a great command line. I will be trying this out! Fremont Concrete Pros
AliceViejo · 44 weeks and 2 days ago ????? ??? ????? ????? SEO - ????? ???? ????? ????? ????? ??? ????? ????? SEO - ????? ???? ????? ????? ????? ??? ????? ????? SEO - ????? ???? ????? ????? ????? ??? ????? ????? SEO - ????? ???? ????? ????? ????? ??? ????? ????? SEO - ????? ???? ????? ????? ????? ??? ????? ????? SEO - ????? ???? ????? ????? ????? ??? ????? ???? SEO ????? ????? ????? ???? ????? ????? ??? ???? ???? ??????? Search Engine Optimization ??? ????? ??????????? ?? ????? ?????????? ????? ????? ?? ???? ???SEO
seofox · 21 weeks and 2 days ago
seofox · 20 weeks and 3 days ago
It’s difficult to find knowledgeable people on this topic, however, you seem like what happens you’re discussing! Thanks ligawd
mtom78632 · 14 weeks and 1 day ago
Some really good articles on this web site , thankyou for contribution. ??????
mtom78632 · 13 weeks and 3 days ago
You really make it seem so easy with your presentation but I find this topic to be really something that I think I would never understand. It seems too complex and extremely broad for me. I’m looking forward for your next post, I’ll try to get the hang of it! kadootjes ============ Hello! I simply would choose to offer a huge thumbs up for your great information you could have here for this post. I will be coming back to your website for much more soon. afscheidscadeau collega
mtom78632 · 11 weeks and 6 days ago
Many thanks picking the correct to go about this in turn, Personally i think really measurements along with really enjoy researching a little more about the idea market. Assuming feasible, since realise mastery, on earth would you intellect adding to ones own blogging site by way of additional information? This is very useful for us. grote oorbellen zilver ============= I am really impressed with your writing skills well with the layout for your weblog. Is that this a paid subject matter or did you modify it your self? Anyway stay up the nice high quality writing, it is rare to see a nice weblog like this one these days. cadeau mand vrouw
mtom78632 · 11 weeks and 3 days ago
I am typically to blogging we actually appreciate your site content. This article has truly peaks my interest. I am about to bookmark your site and keep checking for brand spanking new information. friendly farms cartridges
mtom78632 · 11 weeks and 2 days ago
There may be noticeably a bundle to know about this. I assume you made certain good factors in features also. slot gacor================================================ Thanks, I’ve recently been searching for info about this subject matter for ages and yours is the best I’ve discovered so far. Dewagame88
mtom78632 · 10 weeks and 6 days ago
Hrmm that was weird, my comment got eaten. Anyway I wanted to say that it’s good to be aware that somebody else also mentioned that as I had trouble finding the exact same info elsewhere. That was the first place that told me the answer. Thanks. ????? ================ Thank you for taking the time to line all this out for people. This particular article was in fact really helpful if you ask me. judi bola
mtom78632 · 10 weeks and 6 days ago
A person necessarily lend a hand to make critically posts I might state. This is the very first time I frequented your web page and thus far? I amazed with the analysis you made to create this actual put up extraordinary. Excellent process! DepEd Calendar 2022
mtom78632 · 10 weeks and 1 day ago
Hey, I am ranking my site higher “pre spun articles”. ?????
mtom78632 · 10 weeks and 1 day ago
I dugg some of you post as I cogitated they were handy extremely helpful abcslot
mtom78632 · 6 weeks and 4 days ago
After research a few of the blog posts in your website now, and I really like your method of blogging. I bookmarked it to my bookmark website listing and will probably be checking again soon. Pls check out my web page as nicely and let me know what you think. renovation
mtom78632 · 5 weeks and 6 days ago
Hi, very nice post, i certainly love this website, keep on it ????============================================== This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It’s the old what goes around comes around routine. ????
mtom78632 · 5 weeks and 3 days ago
Youre so cool! I dont suppose Ive learn anything like this before. So good to search out someone with some authentic ideas on this subject. realy thank you for beginning this up. this web site is one thing that’s needed on the web, someone with somewhat originality. useful job for bringing something new to the internet! home improvement ===== I would like to express thanks to you just for rescuing me from such a circumstance. Because of exploring through the online world and meeting recommendations which were not helpful, I figured my life was done. Being alive devoid of the strategies to the issues you have solved all through the write-up is a serious case, and ones which might have adversely affected my career if I hadn’t discovered your web blog. Your primary ability and kindness in handling every aspect was very useful. I am not sure what I would’ve done if I had not come upon such a step like this. I am able to at this time look forward to my future. Thank you so much for this skilled and amazing help. I won’t hesitate to recommend your web sites to any person who desires support about this subject matter. beverage cans for sale
mtom78632 · 1 week and 5 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? 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.


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: