3 ms·
Thank you, that helped. I had to get rid of '^' anchors (because it's not processing individual lines anymore) and I put sed -e '' < /dev/stdin into the scr
by aargh_aargh 9y ago
Thank you, that helped. I had to get rid of '^' anchors (because it's not processing individual lines anymore) and I put
sed -e '' < /dev/stdin
into the script, but the solution is now much simpler and faster.
- sebcat 9y agosed 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.