Quantcast
Viewing latest article 3
Browse Latest Browse All 5

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.

Image may be NSFW.
Clik here to view.
commandlinefu.com

Diff your entire server config at ScriptRock.com


Viewing latest article 3
Browse Latest Browse All 5

Trending Articles