Merge pull request #91 from alexberry/patch-1
Adding a few more useful examples to sed.pull/94/head
commit
4b35ff0a27
@ -1,2 +1,14 @@
|
|||||||
# Edit a file, via substitution, in-place; changes are made to the file(s).
|
# Preview a file edit, via substitution.
|
||||||
|
sudo sed 's/Name=Xfce Session/Name=Xfce_Session/' /usr/share/xsessions/xfce.desktop
|
||||||
|
|
||||||
|
# Replace the same string more than once per line (appending g flag), via substitution.
|
||||||
|
sudo sed 's/Name=Xfce Session/Name=Xfce_Session/g' /usr/share/xsessions/xfce.desktop
|
||||||
|
|
||||||
|
# Edit a file (adding -i flag), via substitution, in-place; changes are made to the file(s).
|
||||||
sudo sed -i 's/Name=Xfce Session/Name=Xfce_Session/' /usr/share/xsessions/xfce.desktop
|
sudo sed -i 's/Name=Xfce Session/Name=Xfce_Session/' /usr/share/xsessions/xfce.desktop
|
||||||
|
|
||||||
|
# It can become necessary to escape special characters in your string.
|
||||||
|
sed -i 's/\/path\/to\/somewhere\//\/path\/to\/anotherplace\//' /tmp/filetoedit
|
||||||
|
|
||||||
|
# Change your sed delimiter to a pipe to avoid escaping slashes.
|
||||||
|
sed -i 's|/path/to/somewhere/|/path/to/anotherplace/|' /tmp/filetoedit
|
||||||
|
Loading…
Reference in New Issue