加入收藏 | 设为首页 | 会员中心 | 我要投稿 新余站长网 (https://www.0790zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Sed - An Introduction and Tutorial by Bruce Barnett

发布时间:2021-01-29 08:45:10 所属栏目:Linux 来源:网络整理
导读:http://www.grymoire.com/unix/sed.html Quick Links - NEW table border="1" tr Sed Pattern Flags /tr tr td a href="http://www.grymoire.com/unix/Sed.html#uh-6"gt;/g?- Global/td /tr tr td a href="http://www.grymoire.com/unix/Sed.html#uh-10a"gt;
副标题[/!--empirenews.page--]

http://www.grymoire.com/unix/sed.html

Quick Links - NEW

<table border="1">
<tr></tr>
<tr>
<td>
<a href="http://www.grymoire.com/unix/Sed.html#uh-6"&gt;/g?- Global</td>
</tr>
<tr>
<td>
<a href="http://www.grymoire.com/unix/Sed.html#uh-10a"&gt;/I?- Ignore Case</td>
</tr>
<tr>
<td>
<a href="http://www.grymoire.com/unix/Sed.html#uh-9"&gt;/p?- Print</td>
</tr>
<tr>
<td>
<a href="http://www.grymoire.com/unix/Sed.html#uh-10"&gt;/w filename?- Write Filename</td>
</tr>

<table border="1">
<tr></tr>
<tr>
<td><a href="http://www.grymoire.com/unix/Sed.html#uh-13"&gt;-e script (--expression=script)</td>
</tr>
<tr>
<td><a href="http://www.grymoire.com/unix/Sed.html#uh-16"&gt;-f scriptfile (--file=scriptfile)</td>
</tr>
<tr>
<td><a href="http://www.grymoire.com/unix/Sed.html#uh-19b"&gt;-h (--help)</td>
</tr>
<tr>
<td><a href="http://www.grymoire.com/unix/Sed.html#uh-15"&gt;-n (--quiet --silent)</td>
</tr>
<tr>
<td><a href="http://www.grymoire.com/unix/Sed.html#uh-19a"&gt;-V (--version)</td>
</tr>

Table of Contents

Copyright 1994,1995 Bruce Barnett and General Electric Company

Copyright 2001,2005,2007,2011,2013 Bruce Barnett

All rights reserved

You are allowed to print copies of this tutorial for your personal use,and link to this page,but you are not allowed to make electronic copies,or redistribute this tutorial in any form without permission.

Original version written in 1994 and published in the Sun Observer

Introduction to Sed

How to use sed,a special editor for modifying files automatically. If you want to write a program to make changes in a file,sed is the tool to use.

There are a few programs that are the real workhorse in the UNIX toolbox. These programs are simple to use for simple applications,yet have a rich set of commands for performing complex actions. Don't let the complex potential of a program keep you from making use of the simpler aspects. I'll start with the simple concepts and introduce the advanced topics later on.?When I first wrote this,most versions of sed did not allow you to place comments inside the script. Lines starting with the '#' characters are comments. Newer versions of sed may support comments at the end of the line as well.

Sed?is the ultimate?stream?editor. If that sounds strange,picture a stream flowing through a pipe. Okay,you can't see a stream if it's inside a pipe. That's what I get for attempting a flowing analogy. You want literature,read James Joyce.

Anyhow,?sed?is a marvelous utility. Unfortunately,most people never learn its real power. The language is very simple,but the documentation is terrible. The Solaris on-line manual pages for?sed?are five pages long,and two of those pages describe the 34 different errors you can get. A program that spends as much space documenting the errors than it does documenting the language has a serious learning curve.

(编辑:新余站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

Sed Pattern Flags
Sed Command Line options