O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.2. Calling sed

You can invoke sed in three ways: by typing the commands on the command line; by inserting sed commands in a script file then calling sed; or by inserting sed commands in a script file and making the script executable.

To use sed from the command line for one-liners use:

sed [options] 'sed-commands' input-file(s) 

Remember when using sed commands on the command line to surround the actual commands with single quotes, although sed will tolerate double quotes.

To use a sed script file use this format:

sed [ options] -f sed-script-file input-file(s) 

To use a sed script file that has the sed command interpreter line as the first line of the script file use this format:

sed-script-file [options] input-file(s) 

Whether you are running ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required