mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-19 03:25:44 +00:00
0adbf03348
* sheets/MegaCli * sheets/az * sheets/azure * sheets/blktrace * sheets/emacs * sheets/exim * sheets/go * sheets/ipython * sheets/jq * sheets/nmap * sheets/perl * sheets/psql * sheets/redis * sheets/sed * sheets/smartctl * sheets/solidity * sheets/yq_v4
18 lines
681 B
Plaintext
18 lines
681 B
Plaintext
# sed
|
|
# A stream editor. Used to perform basic text transformations
|
|
|
|
# Preview a file edit, via substitution.
|
|
sudo sed 's/Name=Xfce Session/Name=Xfce_Session/' FILE
|
|
|
|
# Replace the same string more than once per line (g flag)
|
|
sudo sed 's/Name=Xfce Session/Name=Xfce_Session/g' FILE
|
|
|
|
# Edit a file (adding -i flag), in-place; changes are made to the file(s).
|
|
sudo sed -i 's/Name=Xfce Session/Name=Xfce_Session/' FILE
|
|
|
|
# It can become necessary to escape special characters in your string.
|
|
sed -i 's/\/path\/to\/somewhere\//\/path\/to\/anotherplace\//' FILE
|
|
|
|
# Change your sed delimiter to a pipe to avoid escaping slashes.
|
|
sed -i 's|/path/to/somewhere/|/path/to/anotherplace/|' FILE
|