用grep可以定位到一行文字,如果我想得到这行下面的那行文字,应该如何写呢?
比如oracle日志中的alter.log,找到最后一次shutdown的时间。shutdown那行用grep很容易找到,可下面的那一行文字,如何顺序取出啊? :0(1
alter.log
Wed Apr 11 20:00:32 2007
Shutting down instance: further logons disabled
Shutting down instance (immediate)
License high water mark = 42
Wed Apr 11 20:00:33 2007
ALTER DATABASE CLOSE NORMAL
Wed Apr 11 20:00:33 2007
SMON: disabling tx recovery
SMON: disabling cache recovery
Wed Apr 11 20:00:33 2007
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Thread 1 closed at log sequence 1202
Successful close of redo thread 1
还有从后向前查有没有什么直接的参数? 是不是只能通过循环语句,逐条读取到文件末尾啊?
[ 本帖最后由 kenny 于 2007-4-12 13:20 编辑 ]


qw3206 于 2014-01-09 18:46:14发表:
可以
qxfsy 于 2014-01-04 10:42:18发表:
值得学习
kenny 于 2007-04-12 15:44:53发表:
那好吧,这还挺麻烦。
adonv 于 2007-04-12 12:59:00发表:
去看一下正则表达式吧~比你的方法要好用得多~