⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 451.html

📁 著名的linux英雄站点的文档打包
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<br>
 # delete all CONSECUTIVE blank lines from file except the first; also
<br>
 # deletes all blank lines from top and end of file (emulates "cat -s")
<br>
 sed '/./,/^$/!d'          # method 1, allows 0 blanks at top, 1 at EOF
<br>
 sed '/^$/N;/$/D'        # method 2, allows 1 blank at top, 0 at EOF
<br>
<br>
 # delete all CONSECUTIVE blank lines from file except the first 2:
<br>
 sed '/^$/N;/$/N;//D'
<br>
<br>
 # delete all leading blank lines at top of file
<br>
 sed '/./,$!d'
<br>
<br>
 # delete all trailing blank lines at end of file
<br>
 sed -e :a -e '/^*$/{$d;N;ba' -e '}'  # works on all seds
<br>
 sed -e :a -e '/^*$/N;/$/ba'        # ditto, except for gsed 3.02*
<br>
<br>
 # delete the last line of each paragraph
<br>
 sed -n '/^$/{p;h;};/./{x;/./p;}'
<br>
<br>
SPECIAL APPLICATIONS:
<br>
<br>
 # remove nroff overstrikes (char, backspace) from man pages. The 'echo'
<br>
 # command may need an -e switch if you use Unix System V or bash shell.
<br>
 sed "s/.`echo `//g"    # double quotes required for Unix environment
<br>
 sed 's/.^H//g'             # in bash/tcsh, press Ctrl-V and then Ctrl-H
<br>
 sed 's/.x08//g'           # hex expression for sed v1.5
<br>
<br>
 # get Usenet/e-mail message header
<br>
 sed '/^$/q'                # deletes everything after first blank line
<br>
<br>
 # get Usenet/e-mail message body
<br>
 sed '1,/^$/d'              # deletes everything up to first blank line
<br>
<br>
 # get Subject header, but remove initial "Subject: " portion
<br>
 sed '/^Subject: */!d; s///;q'
<br>
<br>
 # get return address header
<br>
 sed '/^Reply-To:/q; /^From:/h; /./d;g;q'
<br>
<br>
 # parse out the address proper. Pulls out the e-mail address by itself
<br>
 # from the 1-line return address header (see preceding script)
<br>
 sed 's/ *(.*)//; s/&gt;.*//; s/.*[:&lt;] *//'
<br>
<br>
 # add a leading angle bracket and space to each line (quote a message)
<br>
 sed 's/^/&gt; /'
<br>
<br>
 # delete leading angle bracket & space from each line (unquote a message)
<br>
 sed 's/^&gt; //'
<br>
<br>
 # remove most HTML tags (accommodates multiple-line tags)
<br>
 sed -e :a -e 's/&lt;[^&gt;]*&gt;//g;/&lt;/N;//ba'
br&gt;
<br>
 # extract multi-part uuencoded binaries, removing extraneous header
<br>
 # info, so that only the uuencoded portion remains. Files passed to
<br>
 # sed must be passed in the proper order. Version 1 can be entered
<br>
 # from the command line; version 2 can be made into an executable
<br>
 # Unix shell script. (Modified from a script by Rahul Dhesi.)
<br>
 sed '/^end/,/^begin/d' file1 file2 ... fileX | uudecode   # vers. 1
<br>
 sed '/^end/,/^begin/d' "$@" | uudecode                    # vers. 2
<br>
<br>
 # zip up each .TXT file individually, deleting the source file and
<br>
 # setting the name of each .ZIP file to the basename of the .TXT file
<br>
 # (under DOS: the "dir /b" switch returns bare filenames in all caps).
<br>
 echo @echo off &gt;zipup.bat
<br>
 dir /b *.txt | sed "s/^(.*).TXT/pkzip -mo 1 1.TXT/" &gt;&gt;zipup.bat
<br>
<br>
TYPICAL USE: Sed takes one or more editing commands and applies all of
<br>
them, in sequence, to each line of input. After all the commands have
<br>
been applied to the first input line, that line is output and a second
<br>
input line is taken for processing, and the cycle repeats. The
<br>
preceding examples assume that input comes from the standard input
<br>
device (i.e, the console, normally this will be piped input). One or
<br>
more filenames can be appended to the command line if the input does
<br>
not come from stdin. Output is sent to stdout (the screen). Thus:
<br>
<br>
 cat filename | sed '10q'        # uses piped input
<br>
 sed '10q' filename              # same effect, avoids a useless "cat"
<br>
 sed '10q' filename &gt; newfile    # redirects output to disk
<br>
<br>
For additional syntax instructions, including the way to apply editing
<br>
commands from a disk file instead of the command line, consult "sed &
<br>
awk, 2nd Edition," by Dale Dougherty and Arnold Robbins (O'Reilly,
<br>
1997; http://www.ora.com), "UNIX Text Processing," by Dale Dougherty
<br>
and Tim O'Reilly (Hayden Books, 1987) or the tutorials by Mike Arst
<br>
distributed in U-SEDIT2.ZIP (many sites). To fully exploit the power
<br>
of sed, one must understand "regular expressions." For this, see
<br>
"Mastering Regular Expressions" by Jeffrey Friedl (O'Reilly, 1997).
<br>
The manual ("man") pages on Unix systems may be helpful (try "man
<br>
sed", "man regexp", or the subsection on regular expressions in "man
<br>
ed"), but man pages are notoriously difficult. They are not written to
<br>
teach sed use or regexps to first-time users, but as a reference text
<br>
for those already acquainted with these tools.
<br>
<br>
QUOTING SYNTAX: The preceding examples use single quotes ('...')
<br>
instead of double quotes ("...") to enclose editing commands, since
<br>
sed is typically used on a Unix platform. Single quotes prevent the
<br>
Unix shell from intrepreting the dollar sign ($) and backquotes
<br>
(`...`), which are expanded by the shell if they are enclosed in
<br>
double quotes. Users of the "csh" shell and derivatives will also need
<br>
to quote the exclamation mark (!) with the backslash (i.e., !) to
<br>
properly run the examples listed above, even within single quotes.
<br>
Versions of sed written for DOS invariably require double quotes
<br>
("...") instead of single quotes to enclose editing commands.
<br>
<br>
USE OF '	' IN SED SCRIPTS: For clarity in documentation, we have used
<br>
the expression '	' to indicate a tab character (0x09) in the scripts.
<br>
However, most versions of sed do not recognize the '	' abbreviation,
<br>
so when typing these scripts from the command line, you should press
<br>
the TAB key instead. '	' is supported as a regular expression
<br>
metacharacter in awk, perl, and HHsed, sedmod, and GNU sed v3.02.80.
<br>
<br>
VERSIONS OF SED: Versions of sed do differ, and some slight syntax
<br>
variation is to be expected. In particular, most do not support the
<br>
use of labels (:name) or branch instructions (b,t) within editing
<br>
commands, except at the end of those commands. We have used the syntax
<br>
which will be portable to most users of sed, even though the popular
<br>
GNU versions of sed allow a more succinct syntax. When the reader sees
<br>
a fairly long command such as this:
<br>
<br>
   sed -e '/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d
<br>
<br>
it is heartening to know that GNU sed will let you reduce it to:
<br>
<br>
   sed '/AAA/b;/BBB/b;/CCC/b;d'      # or even
<br>
   sed '/AAA|BBB|CCC/b;d'
<br>
<br>
In addition, remember that while many versions of sed accept a command
<br>
like "/one/ s/RE1/RE2/", some do NOT allow "/one/! s/RE1/RE2/", which
<br>
contains space before the 's'. Omit the space when typing the command.
<br>
<br>
OPTIMIZING FOR SPEED: If execution speed needs to be increased (due to
<br>
large input files or slow processors or hard disks), substitution will
<br>
be executed more quickly if the "find" expression is specified before
<br>
giving the "s/.../.../" instruction. Thus:
<br>
<br>
   sed 's/foo/bar/g' filename         # standard replace command
<br>
   sed '/foo/ s/foo/bar/g' filename   # executes more quickly
<br>
   sed '/foo/ s//bar/g' filename      # shorthand sed syntax
<br>
<br>
On line selection or deletion in which you only need to output lines
<br>
from the first part of the file, a "quit" command (q) in the script
<br>
will drastically reduce processing time for large files. Thus:
<br>
<br>
   sed -n '45,50p' filename           # print line nos. 45-50 of a file
<br>
   sed -n '51q;45,50p' filename       # same, but executes much faster
<br>
<br>
If you have any additional scripts to contribute or if you find errors
<br>
in this document, please send e-mail to the compiler. Indicate the
<br>
version of sed you used, the operating system it was compiled for, and
<br>
the nature of the problem. Various scripts in this file were written
<br>
or contributed by:
<br>
<br>
 Al Aab &lt;af137@freenet.toronto.on.ca&gt;   # "seders" list moderator
<br>
 Edgar Allen &lt;era@sky.net&gt;              # various
<br>
 Yiorgos Adamopoulos &lt;adamo@softlab.ece.ntua.gr&gt;
<br>
 Dale Dougherty &lt;dale@songline.com&gt;     # author of "sed & awk"
<br>
 Carlos Duarte &lt;cdua@algos.inesc.pt&gt;    # author of "do it with sed"
<br>
 Eric Pement &lt;pemente@northpark.edu&gt;    # author of this document
<br>
 Ken Pizzini &lt;ken@halcyon.com&gt;          # author of GNU sed v3.02
<br>
 S.G. Ravenhall &lt;stew.ravenhall@totalise.co.uk&gt; # great de-html script
<br>
 Greg Ubben &lt;gsu@romulus.ncsc.mil&gt;      # many contributions & much help
<br>
-------------------------------------------------------------------------
<br>
</FONT><br>
                                      </TD>
                                    </TR>
                                <TR>
                                <TD colSpan=2><FONT 
                                class=middlefont></FONT><BR>
                                        <FONT 
                                class=normalfont>全文结束</FONT> </TD>
                                    </TR>
                                <TR>
                                <TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2 
                                height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
                        <TD vAlign=top width="20%" 
                      background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2> 
                          <DIV align=center> 
                            <table class=tableoutline cellspacing=1 cellpadding=4 
                        width="100%" align=center border=0>
                              <tr class=firstalt> 
                                <td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
                                <font class=normalfont><b>所有分类</b></font></td>
                              </tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td>    </tr>  </table></td></tr>                            </table>
                          </DIV></TD></TR>
                    <TR vAlign=top>
                        <TD width="80%"> 
                          <DIV align=center><BR>
                          </DIV>
                        </TD></TR></TBODY></TABLE></TD></TR>
                </TABLE></TD></TR>
          </TABLE>
      <TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee 
        border=0><TBODY>
        <TR>
          <TD width="50%">
              <P><FONT class=middlefont>版权所有 &copy; 2004 <A 
            href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
                违者必究. </FONT></P>
            </TD>
          <TD width="50%">
              <DIV align=right><FONT class=middlefont>Powered by: <A 
            href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
            </TD></TR></TBODY></TABLE>
      <CENTER></CENTER></TD></TR>
    </TABLE></CENTER></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -