Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: