|
#script logfile
输入完后ctrl+d结束,logfile里就是你操作的过程。
比如下面这个logfile记录练习sed的过程:
#more logfile
Script started on 2005年05月08日 星期日 23时47分59秒
limon@Gentoo ~/learn $ cat test.txt
The honeysuckle band played all night long for only $90.
It was an evening of splendid music and company.
Too bad the disco floor fell through at 23:00.
The local nurse Miss P.Neave was in attendance.
limon@Gentoo ~/learn $ sed -n '2p' test.txt
It was an evening of splendid music and company.
limon@Gentoo ~/learn $ sed -n '1,3p' test.txt
The honeysuckle band played all night long for only $90.
It was an evening of splendid music and company.
Too bad the disco floor fell through at 23:00.
limon@Gentoo ~/learn $ sed -n '/The/p' test.txt
The honeysuckle band played all night long for only $90.
The local nurse Miss P.Neave was in attendance.
limon@Gentoo ~/learn $ sed -n '4,/The/p' test.txt
The local nurse Miss P.Neave was in attendance.
limon@Gentoo ~/learn $ sed -n '1,$p' test.txt
The honeysuckle band played all night long for only $90.
It was an evening of splendid music and company.
Too bad the disco floor fell through at 23:00.
The local nurse Miss P.Neave was in attendance.
limon@Gentoo ~/learn $ sed -n '/\$/p test.txt
> bash: unexpected EOF while looking for matching `''
bash: syntax error: unexpected end of file
limon@Gentoo ~/learn $ sed -n '/\$/p' test.txt
The honeysuckle band played all night long for only $90.
limon@Gentoo ~/learn $
Script done on 2005年05月08日 星期日 23时49分37秒
:rolleyes: |
|