Sed Quick Reference Page - Bruce Barnett

Home
Index Quotes Bourne Shell POSIX Shell C Shell File Permissions Regular Expressions grep awk sed find tar make inodes
Index IPv6 Wireless Hardware
Index spam Deception PostScript Halftones Bill of Rights
Index Top 10 reasons to avoid CSH sed Chart awk Reference
Magic Search About Donate

Last modified: Mon Dec 7 09:58:22 2020

You can buy me a coffee

I would appreciate it if you occasionally buy me a coffee as it helps maintain this site. Thanks to those who do!

Check out my Sed Reference Chart (pdf)

Here is a quick reference to the major parts of SED, with links to my extended tutorial on commands, flags and options. I've placed it on this page to make my web site more mobile-friendly.

Unix Concepts

Unix Concepts
Bypassing the shell by quoting characters
Regular Expressions

Sed Concepts

Sed Concepts
Table of Contents
The basic Substitute operation "s"
Addresses (limiting the operation to a subset of lines)
Patterns - using Regular Expressions
Flags that operate on Patterns
Command Line Options
GNU sed Command Line Options
Adding, Changing, Inserting new lines
Working with Multiple Line patterns
Summary of Commands

Pattern Flags (used after a regular expression)

Sed Pattern Flags
/g - Global
/I - Ignore Case
/p - Print
/w filename - Write Filename

Sed command line options

Sed Command Line options
Short Option (Long option)Sed version
-n Classic
-e script Classic
-f scriptfile Classic
-e script (--expression=script) GNU sed
-f scriptfile (--file=scriptfile) GNU sed
-h (--help) GNU sed
-n (--quiet --silent) GNU sed
-V (--version) GNU sed
-r (--regexp-extended) GNU sed
-i[SUFFIX] (--in-place[=SUFFIX]) GNU sed
-l N (--line-length=N) GNU sed
-b (--binary) GNU sed
-s (--separate) GNU sed
-z (--null-data) GNU sed
-u (--unbuffered) GNU sed
(--follow-symlinks) GNU sed
(--posix) GNU sed
-i SUFFIX Mac OS X, FreeBSD
-a Mac OS X, FreeBSD
-l Max OS X, FreeBSD
-E Mac OS X, FreeBSD
-r FreeBSD
-I SUFFIX FreeBSD

Sed operational commands

Sed 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

I hope you find this useful.

AltStyle によって変換されたページ (->オリジナル) /