cli-sedHow do I use a CLI sed query?
sed command is a powerful utility for editing text files from the command line. It can be used to perform complex search and replace operations.
sed, you must provide a query string that describes the search and replace operations you want to perform. Here is an example of a
sed -i 's/old_word/new_word/g' file.txt
This query will search for all instances of
file.txt and replace them with
-i flag tells
sed to edit the file in-place.
Here is a breakdown of the command parts:
sed: the command itself
-i: the flag that tells
sedto edit the file in-place
s/old_word/new_word/g: the search and replace query, which consists of:
s: the search and replace operation
old_word: the word to search for
new_word: the word to replace with
g: the global flag, which tells
sedto replace all occurrences of
file.txt: the file to edit
For more information on
sed, see the GNU sed Manual.
More of Cli Sed
- How can I use the 'sed' command line utility to add quotes around a string?
- How do I use the CLI to configure Zabbix?
- How can I use the command line to compress and edit files with sed and zip?
- How can I use the command line to edit text using Qt?
- How can I use SED in a Windows command line interface?
- How can I set up the Xcode command line interface?
- How do I use sed to add quotes around a string in a command line interface?
- How do I use the command line to compress a file using SED and ZIP?
- How can I use sed in a command line interface?
- How do I use the command line to edit text using sed?
See more codes...