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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access