开发者

How do I use the sed command to remove all lines between 2 phrases (including the phrases themselves)

I am generating a log from which I want to remove X startup output which looks like this:

X.Org X Server 1.7.6
Release Date: 2010-03-17
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.31-607-imx51 armv7l Ubuntu
Current Operating System: Linux nvidia 2.6.33.2 #1 SMP PREEMPT Mon May
31 21:38:29 PDT 2010 armv7l
Kernel command line: mem=448M@0M nvmem=64M@448M mem=512M@512M
chipuid=097c81c6425f70d7 vmalloc=320M video=tegrafb
console=ttyS0,57600n8 usbcore.old_scheme_first=1 tegraboot=nand
root=/dev/nfs ip=:::::usb0:on rw  tegra_ehci_probe_delay=5000 smp dvfs
tegrapart=recovery:1b80:a00:800,boot:2680:1000:800,environment:3780:40:800,system:38c0:2bc00:800,cache:2f5c0:4000:800,userdata:336c0:c840:800
envsector=3080
Build Date: 23 April 2010  05:19:26PM
xorg-server 2:1.7.6-2ubuntu7 (Bryce Harrington <bryce@ubuntu.com>)
Current version of pixman: 0.16.4
       Before reporting problems, check http://wiki.x.org
       to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
       (++) from command line, (!!) notice, (II) informational,
       (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Wed Jun 16 19:52:00 2010
(==) Usi开发者_StackOverflow中文版ng config file: "/etc/X11/xorg.conf"
(==) Using config directory: "/usr/lib/X11/xorg.conf.d"

Is there any way to do this without manually checking pattern for each line?


Possibly:

sed '1,/^(==) Using config directory: "/d'

Or, possibly:

sed '/^X.Org X Server /,/^(==) Using config directory: "/d'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜