Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Sed
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Other sed commands=== Besides substitution, other forms of simple processing are possible, using some 25 sed commands. For example, the following uses the ''d'' command to filter out lines that only contain spaces, or only contain the end of line character: <syntaxhighlight lang=bash> sed '/^ *$/d' inputFileName </syntaxhighlight> This example uses some of the following [[regular expression]] [[metacharacter]]s (sed supports the full range of regular expressions): * The [[caret]] (<code>^</code>) matches the beginning of the line. * The [[dollar sign]] (<code>$</code>) matches the end of the line. * The [[asterisk]] (<code>*</code>) matches zero or more occurrences of the previous character. * The [[Plus and minus signs#Plus sign|plus]] (<code>+</code>) matches one or more occurrence(s) of the previous character. * The [[question mark]] (<code>?</code>) matches zero or one occurrence of the previous character. * The [[Full stop|dot]] (<code>.</code>) matches exactly one character. Complex sed constructs are possible, allowing it to serve as a simple, but highly specialized, [[programming language]]. Flow of control, for example, can be managed by the use of a [[Label (programming language)|label]] (a colon followed by a string) and the branch instruction <code>b</code>, as well as the conditional branch <code>t</code>. An instruction <code>b</code> followed by a valid label name will move processing to the command following that label. The <code>t</code> instruction will only do so if there was a successful substitution since the previous <code>t</code> (or the start of the program, in case of the first <code>t</code> encountered). Additionally, the <code>{</code> instruction starts a [[Block (programming)|subsequence]] of commands (up to the matching <code>}</code>); in most cases, it will be conditioned by an address pattern.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Sed
(section)
Add topic