Replace lines in files with only spaces/tabs with simple empty line (within current directory - recursive)

find . -type f -regex '.*\.\(cpp\|h\)' -exec sed -i 's/^[[:blank:]]\+$//g' {} +

0
2020-09-15 09:07:08

What Others Think

Thanks for sharing this. It could be more informational and understanding for us if you can explain it in detail. Hostsailor I hope that you will send it to me in the next post and try to update with this.
zaiyamariya · 30 weeks ago
Let's play with us. We can always have great time super smash flash 2
Walter88 · 29 weeks and 6 days ago
hggfgh google
KennethIWilliams · 27 weeks ago
great content! will recommend this site to my friends
looneyhans · 24 weeks and 5 days ago
I don’t even know how I ended up right here, however I assumed this commands was great. More Commands
wendyparis19 · 24 weeks and 3 days ago
gad i found this site. really learned alot hair extensions boise
looneyhans · 24 weeks ago
guitar lessons des moines I need to know more
yeoyeo · 21 weeks and 5 days ago
are there any recent updates? fencingspringfieldmo.com
looneyhans · 20 weeks and 1 day ago
very helpful! bathroomremodelgreenbay.com
Killersmile · 19 weeks and 5 days ago
Given the fact that everything is turning towards the digital world reading books on making web Comics can also help greatly For More Information.
Beauvais · 19 weeks and 2 days ago
awesome site thanks alot executive coach new orleans
looneyhans · 17 weeks ago
wow never knew about this before, thanks for sharing! realtor
idasanka · 15 weeks and 5 days ago
I can set up my new idea from this post. It gives in depth information. Thanks for this valuable information for all,.. pool cleaning service
bojokey283 · 15 weeks and 3 days ago
love your ideas! couples counseling
idasanka · 15 weeks and 3 days ago
Admiring the time and effort you put into your blog and detailed information you offer!.. abonnenten24
bojokey283 · 14 weeks and 3 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. automação doméstica
bojokey283 · 14 weeks and 3 days ago
This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself.. online marketing
bojokey283 · 14 weeks and 2 days ago
telemedicine mobile app quickly and seamlessly integrated all changes into the extant architecture. Providing confident, experienced assistance and a forward-thinking approach, the team implemented upgrades that ensured the platform’s future stability and scalability.
DanielCorwen · 14 weeks ago
hearing aids virginia beach Can you tell me a bit more, please?
yeoyeo · 13 weeks and 6 days ago
I will share this content so I can find it in the future days of my class. Thank you! the best cbd creams
aldenbaigan · 12 weeks and 5 days ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. removal companies hartlepool
bojokey283 · 12 weeks and 4 days ago
I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. alquiler carros santa marta
bojokey283 · 12 weeks and 4 days ago
Admiring the time and effort you put into your blog and detailed information you offer!.. tree surgeon in colchester
bojokey283 · 12 weeks and 1 day ago
Very nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!. Heimautomation
bojokey283 · 12 weeks and 1 day ago
I know your expertise on this. I must say we should have an online discussion on this. Writing only comments will close the discussion straight away! And will restrict the benefits from this information. coronavirus playa del carmen
bojokey283 · 11 weeks and 4 days ago
I really enjoyed reading your article. I found this as an informative and interesting post, so i think it is very useful and knowledgeable. I would like to thank you for the effort you have made in writing this friv article.
gulgowski · 10 weeks and 6 days ago
thanks for sharing this with us! love it!
sammm · 10 weeks and 5 days ago
Your work is very good and I appreciate you and hopping for some more informative posts. Thank you for sharing great information to us. best restaurants in cozumel near cruise port
bojokey283 · 10 weeks and 3 days ago
I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. In fact after reading, I had to go show it to my friend and he ejoyed it as well! covid playa del carmen
bojokey283 · 9 weeks and 2 days ago
I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. In fact after reading, I had to go show it to my friend and he ejoyed it as well! covid playa del carmen
bojokey283 · 9 weeks and 2 days ago
This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future... rugalmas ügyvéd Debrecen
bojokey283 · 8 weeks ago
I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!.. otomatisasi rumah
bojokey283 · 7 weeks ago
Thanks for sharing.I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one. LBrands Aces
Richlandd · 6 weeks and 1 day ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. sikerdíjas pályázatírás debrecenieknek
bojokey283 · 6 weeks and 1 day ago
Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks travel cancun to tulum
xoheko1229 · 6 weeks and 1 day ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. cozumel beach bars
xoheko1229 · 5 weeks and 6 days ago
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 is the old what goes around comes around routine. traditional yucatan food
xoheko1229 · 5 weeks and 3 days ago
I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best! best resort in tulum
xoheko1229 · 5 weeks and 2 days ago
Thanks for every other informative site. The place else may just I get that kind of information written in such an ideal means? I have a venture that I’m just now operating on, and I have been on the look out for such information. restaurant in tulum
xoheko1229 · 5 weeks and 1 day ago
I am glad you take pride in what you write. This makes you stand way out from many other writers that push poorly written content. best hotel playa del carmen
xoheko1229 · 4 weeks and 6 days ago
I felt very happy while reading this site. This was really very informative site for me. I really liked it. This was really a cordial post. Thanks a lot!. holbox top restaurants
xoheko1229 · 4 weeks and 4 days ago
Replace only if the file name matches another string / has a specific extension / is of a Recursive, regular files in this and all subdirectories that allow regular expressions , so you can search also tabs ( \t ), new lines ( \n ),etc. Replace newline in result with spaces (so that the list of files can be fed to sed .PrepaidCardStatus
Pridgen281 · 4 weeks and 1 day ago
Select Regular Expression. Enter ^[ \t]*$\r?\n into find what, leave replace empty. This will match all lines starting with white space and ending with carriage return (in this case a windows crlf) Click the Find Next button to see for yourself how it matches only empty lines. mypennmedicine
Park4521 · 3 weeks and 6 days ago
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. treatnheal
xoheko1229 · 3 weeks and 1 day ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. bathroom vanity
bojokey283 · 1 week and 3 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. coronavirus holbox
bojokey283 · 2 days ago
I got sufficient information from your soul of heart.Thank you so much tellpizzahut
BathKoala · 2 hours 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: