一个shell脚本,去掉每行后缀,文件内容为:
gnome-panel-2.16.1-9.f12.src.rpm
kylin-about-1.0.0-1.f12.i386.rpm
kylin-about-1.0.0-1.f12.src.rpm
kylin-menus-3.1.0-1.f12.src.rpm
redhat-menus-6.7.8-3.f12.src.rpm
脚本内容:
#!/bin/bash
for i in *.rpm
do
echo `basename $i .rpm`
done
用sed '1,$s//.rpm//g 亦可。