sedsed是学好sed的得力工具,推荐。官方网址:http://sedsed.sourceforge.net/

即使没有现成的Linux系统,只要安装了python和sed就可运行。

附安装过程:

# cd /bin

# wget http://sedsed.sourceforge.net/sedsed-1.0 -O sedsed

# chmod 755 sedsed

把sed后面的命令附加到sedsed后面

echo www|sed '1p'
echo www|sedsed -d --hide=hold '1p'
PATT:www$
COMM:1 p
www
PATT:www$
www
 
The -d option turns debug ON.
The --hide=hold options hides the HOLD SPACE buffer contents, because it is always empty on this example.
The PATT: lines on sedsed's output shows the PATTERN SPACE buffer contents.
The COMM: yellow lines show the command which is being executed.