Drop the trailing slash!
sed -e \
's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/192.100.100.100/g'
(The split over two lines attempts to ensure visibility of the end of the string.)
Note that sed
starts counting at the s
at the start of the s///
string, not at the start of the sed
word. The trailing /
was at character 75 in that string.
The full script should probably add "all the command line arguments" (aka "$@"
) too:
sed -e \
's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/192.100.100.100/g' \
"$@"
This will read files if they're specified (and would also accept extra editing commands such as -e 's/.*//'
!) or standard input if no arguments are specified. You can put it all on one line in your script; the breaks are for improved clarity on Stack Overflow.