Sed

From Psygen Wiki
Revision as of 16:11, 10 January 2017 by Admin (talk | contribs)
Jump to navigation Jump to search

Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). Sed is similar editors that script edits, but sed only makes one pass over the input(s), and thus is more efficient. But it is sed's ability to filter text in a pipeline which particularly distinguishes it from other types of editors.


Commands

: label

# comment

{....} Block

= print line number

a \ Append

b label Branch

c \ change

d and D Delete

g and G Get

h and H Hold

i \ Insert

l Look

n and N Next

p and P Print

q Quit

r filename Read File

s/..../..../ Substitute

t label Test

w filename Write Filename

x eXchange

y/..../..../ Transform


sed Pattern Flags

/g Global /I Ignore Case /p Print /w filename Write Filename


References

  1. sed man page
  2. Grymoire sed tutorial