Replace spaces with tabs & format file source recursively within a directory

find . -type f -name \*.php | while IFS="" read i; do expand -t4 "$i" > "$i-"; mv "$i-" "$i"; done
Recursively find php files and replace tab characters with spaces. Options: "\*.php" -- replace this with the files you wish to find "expand" -- replace tabs with spaces (use "unexpand" to replace spaces with tabs) "-t4" -- tabs represent 4 spaces Note: The IFS="" in the middle is to prevent 'read' from eating leading/trailing whitespace in filenames.

1 Alternatives + Submit Alt

What Others Think

flatcap, it expands/unexpands *all* file contents. Isn't it? While my command uses smart vim formatting to *indent* using tabs, not touching those in strings, for instance
ruslan · 607 weeks and 6 days ago
Really? Unfortunately, I can't get your command to work. From the vim help on retab: Careful: This command modifies any characters inside of strings in a C program. Use "\t" to avoid this (that's a good habit anyway). By adding --initial to expand (or --first-only to unexpand), it will only work on leading whitespace. As a heavy user of vim, I'd have done this by macro or bufdo. Spawning vim for every file will really slow things down.
flatcap · 607 weeks and 5 days ago
flatcap, what about constructions like $a = array( 'key1' => '12', 'longlongkey' => 'someghing', 'second-long-k' => 12.34, ); ?
ruslan · 607 weeks and 5 days ago
It didn't format like what I mean. Look at this: http://susepaste.org/28853675
ruslan · 607 weeks and 5 days 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 · 13 weeks and 4 days ago
I need to to thank you for this very good read!! I definitely loved every little bit of it. I have you bookmarked to check out new things you post… KickAss Torrents
seomind · 10 weeks ago
Mmm.. good to be here in your article or post, whatever, I think I should also work hard for my own website like I see some good and updated working in your site. Zwembad aanleggen
seomind · 5 weeks and 1 day ago
This post is good enough to make somebody understand this amazing thing, and I’m sure everyone will appreciate this interesting things. Zonnepanelen Sint-Genesius-Rode
seomind · 5 weeks and 1 day ago
Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog. Polyester zwembad
seomind · 5 weeks and 1 day ago
After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article. Zonnepanelen Sint-Pieters-Leeuw
seomind · 5 weeks and 1 day ago
This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck. Inox zwembad
seomind · 5 weeks and 1 day 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. Zonnepanelen Steenokkerzeel
seomind · 5 weeks and 1 day ago
Hi buddies, it is great written piece entirely defined, continue the good work constantly. Monoblok zwembad
seomind · 5 weeks and 1 day ago
This website and I conceive this internet site is really informative ! Keep on putting up! Zonnepanelen Ternat
seomind · 5 weeks and 1 day ago
This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you. Keramische zwembaden
seomind · 5 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. Zonnepanelen Tervuren
seomind · 5 weeks and 1 day ago
Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog. Vinylester zwembad
seomind · 5 weeks and 1 day ago
Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. Zonnepanelen Tielt-Winge
seomind · 5 weeks ago
wow, great, I was wondering how to cure acne naturally. and found your site by google, learned a lot, now i’m a bit clear. I’ve bookmark your site and also add rss. keep us updated. Aanleg zwembad
seomind · 5 weeks ago
Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates. Zonnepanelen Tienen
seomind · 5 weeks 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. LPW zwembad
seomind · 5 weeks ago
I just couldn't leave your website before telling you that I truly enjoyed the top quality info you present to your visitors? Will be back again frequently to check up on new posts. Zonnepanelen Vilvoorde
seomind · 5 weeks ago
I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You. Monoblock zwembaden
seomind · 5 weeks ago
This is truly an practical and pleasant information for all. Thanks for sharing this to us and more power Zonnepanelen Wemmel
seomind · 5 weeks 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 Zwembad plaatsen
seomind · 5 weeks ago
I read that Post and got it fine and informative. Please share more like that... Zonnepanelen Tremelo
seomind · 5 weeks ago
All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks Zwembad tuin
seomind · 5 weeks ago
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well.. Zonnepanelen Wezembeek-Oppem
seomind · 5 weeks ago
Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog. Zwembad laten plaatsen
seomind · 5 weeks ago
This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post! Zonnepanelen Zaventem
seomind · 5 weeks ago
Nice knowledge gaining article. This post is really the best on this valuable topic. Zwembad bouwen
seomind · 5 weeks ago
This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post! Zonnepanelen Zemst
seomind · 5 weeks ago
Nice knowledge gaining article. This post is really the best on this valuable topic. Laserontharing
seomind · 5 weeks ago
Thanks for the best blog. it was very useful for me.keep sharing such ideas in the future as well. Zonnepanelen Zoutleeuw
seomind · 5 weeks 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. Permanente ontharing
seomind · 5 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 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 · 4 weeks and 3 days ago
It was a very good post indeed. I thoroughly enjoyed reading it in my lunch time. Will surely come and visit this blog more often. Thanks for sharing. wireline tools
seomind · 4 weeks ago
Three are usually cheap Ralph Lauren available for sale each and every time you wish to buy. We?na merino odzie? sklep
seomind · 3 weeks ago
I must say, I thought this was a pretty interesting read when it comes to this topic. Liked the material. . . . . FIFA world cup live stream
seomind · 2 weeks and 3 days ago
Thumbs up guys your doing a really good job. Natural dyes producer
seomind · 2 weeks and 3 days ago
It is the intent to provide valuable information and best practices, including an understanding of the regulatory process. Webtoon XYZ
seomind · 2 weeks and 3 days ago
Your site is truly cool and this is an extraordinary moving article. Legal Steroids
seomind · 1 week and 1 day ago
I need to to thank you for this very good read!! I definitely loved every little bit of it. I have you bookmarked to check out new things you post… clean?
seomind · 4 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: