Skip to content

Instantly share code, notes, and snippets.

@daniw
Last active January 1, 2016 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniw/8133747 to your computer and use it in GitHub Desktop.
Save daniw/8133747 to your computer and use it in GitHub Desktop.
replace all "-" with "0"
# replace all "-" with "0" in test2
sed -i -e 's/-;/0;/g' -e 's/-$/0/g' test2
# replace all "-" with "0" in all files in local directory
for i in *; do sed -i -e 's/-;/0;/g' -e 's/-$/0/g' $i; done
# replace all "-" with "0" in all files in all subdirectories
for i in */*; do sed -i -e 's/-;/0;/g' -e 's/-$/0/g' $i; done
# replace all "-" with "0" in all *.csv files in all subdirectories
for i in */*.csv; do sed -i -e 's/-;/0;/g' -e 's/-$/0/g' $i; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment