bash script: looping over arguments
I wrote a script (replace.sh) that replaces a ~ with ~\n. I was wondering
how can I call this script with multiple arguments.
#!/bin/bash
for i in "$*"
do
sed 's/~/~\n/g' "$i"
done
For example I would like to call ./replace.sh text1 text2. It cannot read
the contents of text1 are: 1 ~ 1 ~ 1. After calling the script it should be
1 ~
1 ~
1 ~
No comments:
Post a Comment