Chinaunix首页 | 论坛 | 博客
  • 博客访问: 915388
  • 博文数量: 75
  • 博客积分: 1216
  • 博客等级: 少尉
  • 技术积分: 1998
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-11 16:20
个人简介

优秀是一种习惯

文章分类

全部博文(75)

文章存档

2014年(1)

2013年(29)

2012年(45)

分类: Python/Ruby

2012-09-13 15:22:09

使用shell找出同名文件的文件,并输出文件的全路径

使用find、perl、sort、uniq、sed一起操作如下:
  1. [root@station1 tmp]# find /etc -type f | perl -nle 's/(.*\/)/\1 /;print' | sort -k2 | uniq -f 1 -D | sed -e 's/ //'
  2. /etc/pam.d/atd
  3. /etc/rc.d/init.d/atd
  4. /etc/sysconfig/atd
  5. /etc/rc.d/init.d/auditd
  6. /etc/sysconfig/auditd
  7. /etc/pam.d/authconfig
  8. /etc/security/console.apps/authconfig
  9. /etc/sysconfig/authconfig
  10. /etc/pam.d/authconfig-gtk
  11. /etc/security/console.apps/authconfig-gtk
  12. /etc/pam.d/authconfig-tui
  13. /etc/security/console.apps/authconfig-tui
  14. /etc/rc.d/init.d/autofs
  15. /etc/sysconfig/autofs
  16. /etc/sgml/catalog
  17. /etc/xml/catalog
  18. /etc/certmonger/certmonger.conf
  19. /etc/dbus-1/system.d/certmonger.conf
  20. /etc/rc.d/init.d/cgconfig
  21. /etc/sysconfig/cgconfig
  22. /etc/cups/client.conf
  23. /etc/pulse/client.conf
  24. /etc/selinux/config
  25. /etc/vmware-tools/config
  26. /etc/vmware-tools/state/config
  27. /etc/pam.d/config-util
  28. /etc/security/console.apps/config-util
  29. /etc/rc.d/init.d/cpuspeed
  30. /etc/sysconfig/cpuspeed
  31. /etc/pam.d/crond
  32. /etc/rc.d/init.d/crond
  33. /etc/sysconfig/crond
  34. /etc/cron.daily/cups
  35. /etc/logrotate.d/cups
  36. /etc/pam.d/cups
  37. /etc/portreserve/cups
  38. /etc/rc.d/init.d/cups
  39. /etc/pam.d/cvs
  40. /etc/xinetd.d/cvs
  41. /etc/gdm/Init/Default
  42. /etc/gdm/PostSession/Default
  43. /etc/gdm/PreSession/Default
  44. /etc/depmod.d/dist.conf
  45. /etc/modprobe.d/dist.conf
  46. /etc/dbus-1/system.d/dnsmasq.conf
  47. /etc/dnsmasq.conf
  48. /etc/pam.d/eject
  49. /etc/security/console.apps/eject
  50. /etc/selinux/targeted/contexts/files/file_contexts
  51. /etc/selinux/targeted/modules/active/file_contexts
  52. /etc/selinux/targeted/contexts/files/file_contexts.homedirs
  53. /etc/selinux/targeted/modules/active/file_contexts.homedirs
  54. /etc/rc.d/init.d/firstboot
  55. /etc/sysconfig/firstboot
  56. /etc/pam.d/halt

阅读(2615) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~