$ 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