免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1391 | 回复: 2
打印 上一主题 下一主题

shell帮助 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-11 10:18 |只看该作者 |倒序浏览
我有个文件,内容如下:
  1. xorg-x11-xfs-1.0.2-4.i386
  2. coolkey-devel-1.1.0-6.el5.i386
  3. redhat-lsb-3.1-12.3.EL.el5.centos.i386
  4. firstboot-tui-1.4.27.7-1.el5.centos.i386
  5. yum-updatesd-0.9-2.el5.noarch
  6. dbus-devel-1.1.2-12.el5.i386
  7. bluez-utils-3.7-2.2.el5.centos.i386
  8. apmd-3.2.2-5.i386
  9. gnome-vfs2-2.16.2-4.el5.i386
  10. libgnome-2.16.0-6.el5.i386
  11. libbonoboui-2.16.0-1.fc6.i386
  12. libgnomeui-2.16.0-5.el5.i386
  13. gnome-python2-2.16.0-1.fc6.i386
  14. gnome-python2-canvas-2.16.0-1.fc6.i386
  15. gnome-python2-gconf-2.16.0-1.fc6.i386
  16. gnome-mount-0.5-3.el5.i386
  17. xulrunner-1.9.0.5-1.el5.i386
  18. xulrunner-devel-1.9.0.5-1.el5.i386
  19. hwbrowser-0.30-2.el5.noarch
  20. dogtail-0.6.1-2.el5.noarch
  21. gnome-python2-bonobo-2.16.0-1.fc6.i386
  22. gnome-python2-gnomevfs-2.16.0-1.fc6.i386
复制代码


我怎么让它只显示如下这种格式:
  1. libgnome
  2. libbonoboui
  3. libgnomeui
  4. gnome-python2
  5. gnome-python2-canvas
  6. gnome-python2-gconf
  7. gnome-mount
  8. xulrunner
  9. xulrunner-devel
  10. hwbrowser
  11. dogtail
  12. gnome-python2-bonobo
  13. gnome-python2-gnomevfs
复制代码

论坛徽章:
0
2 [报告]
发表于 2009-06-11 10:22 |只看该作者
sed 's/-[0-9].*//' filename

论坛徽章:
0
3 [报告]
发表于 2009-06-11 10:22 |只看该作者
sed 's/-[0-9]*\..*$//g'
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP