34.2 Invoking sedIf you were using sed on the fly, as a stream editor (34.1 ) , you might execute it as simply as this: % Given filenames, sed will read them instead of standard input: % A simple script can go right on the command line. If you want to execute more than one editing command, you can use the -e option: % or you can use semicolons ( % or (especially useful in shell scripts (1.5 ) ) you can use the Bourne shell's ability to understand multiline commands: sed ' s/old/new/ /bad/d' myfile or you can put your commands into a file, and tell sed to read that file with the -f option: % There's only one other command-line option: -n . sed normally prints every line of its input (except those that have been deleted by the editing script). But there are times when you only want lines that your script has affected, or that you explicitly ask for with the p command. In these cases, use -n to suppress the normal output. - |
|