Sed: Difference between revisions

imported>Cov
Created page with ''''Sed''' is an extremely handy commandline *nix tool. Refer to its manual page for a more extensive overview of its capabilities. =Uses= ==Substitution== The most popular comma…'
 
Undo revision 1837 by [[Special:Contributions/imported>Pew|imported>Pew]] ([[User talk:imported>Pew|talk]])
Tag: Undo
 
(5 intermediate revisions by 3 users not shown)
Line 3: Line 3:
=Uses=
=Uses=
==Substitution==
==Substitution==
The most popular command of sed is the <code>s</code> command for substitution. To use the command, type an s followed by a delimiting character followed by a regular expression to find followed by the delimiting character followed by an expression with which to replace what was found followed by a final delimiting character. (<code>/</code> is the conventional delimiting character and potentially required by some versions of sed. GNU sed can take any character however, and when URLs or paths are involved, <code>%</code> is often a handy choice to lessen the amount of escaping required.)
The most popular command of sed is the <code>s</code> command for substitution. To use the command, type an s, followed by a delimiting character, followed by a regular expression to look for, followed by the delimiting character, followed by an expression with which to replace what was found, followed by a final delimiting character. (<code>/</code> is the conventional delimiting character and potentially required by some versions of sed. GNU sed can take any character however, and when URLs or paths are involved, <code>%</code> is often a handy choice to lessen the amount of escaping required.)
<pre>
<pre>
$ echo "Never let schooling interfere with your education." | sed 's/schooling/video games/'
$ echo "Never let schooling interfere with your education." | sed 's/schooling/video games/'
Line 19: Line 19:
* [[Central Authentication System#Scripted Login]]
* [[Central Authentication System#Scripted Login]]


[[Category:*nix commandline software]]
[[Category:Software]]
[[Category:Howtos]]