4 ms·
sed works on stdin by default (see third example) so there shouldn't be a need to pipe from /dev/stdin, and line anchors should still work. $ cat myfile
by sebcat 9y ago
sed works on stdin by default (see third example) so there shouldn't be a need to pipe from /dev/stdin, and line anchors should still work.
$ cat myfile
foo foo
baz baz
$ cat foo.sh
#!/bin/sh
sed 's/^foo/bar/;s/^baz/foobar/'
$ ./foo.sh < myfile
bar foo
foobar baz
Depending on your expression, you may want to use -E to get POSIX ERE syntax.