免费注册 查看新帖 |

Chinaunix

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

[文本处理] sed能否用file1的内容替换掉file2特定行的内容 [复制链接]

论坛徽章:
2
亥猪
日期:2015-01-19 15:47:392015年亚洲杯之朝鲜
日期:2015-04-08 16:27:18
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-05-21 15:40 |显示全部楼层 |倒序浏览



如图
咋用sed让file1的字符串替换file2文件里的特定行的字符串,谢谢

论坛徽章:
2
亥猪
日期:2015-01-19 15:47:392015年亚洲杯之朝鲜
日期:2015-04-08 16:27:18
2 [报告]
发表于 2015-05-21 16:20 |显示全部楼层
就是用下面那张图里的内容替换上面那张图的特定的三行,address,netmask,gateway这三行回复 2# little_angel


   

论坛徽章:
2
亥猪
日期:2015-01-19 15:47:392015年亚洲杯之朝鲜
日期:2015-04-08 16:27:18
3 [报告]
发表于 2015-05-21 16:22 |显示全部楼层
  1.         address 192.168.1.123
  2.         netmask 255.255.255.0
  3.         gateway 192.168.1.1
复制代码
  1. # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

  2. # The loopback interface
  3. auto lo
  4. iface lo inet loopback


  5. # Wireless interfaces
  6. #
  7. # Example of an unencrypted (no WEP or WPA) wireless connection
  8. # that connects to any available access point:
  9. #
  10. iface wlan0 inet dhcp
  11.         wireless_mode managed
  12.         wireless_essid any
  13. #
  14. #
  15. # Same as above but locked to a specific access point:
  16. #
  17. #iface wlan0 inet dhcp  
  18. #        wireless_mode managed
  19. #        wireless-essid some-essid
  20. #
  21. # A WEP encrypted connection locked to a specific access point:
  22. #
  23. #iface wlan0 inet dhcp  
  24. #        wireless-essid some-essid
  25. #        wireless-key s:My-PlainText-Password
  26. #        wireless-mode managed                  
  27. #
  28. # A WPA1 or WPA2 encrypted connection locked to a specific access point.
  29. # This is the best option for non-roaming, single-network usage.
  30. # Note that your card may require a firmware update to use WPA.
  31. # Some distributions install a temporary volatile firmware update on ifup.
  32. #
  33. #iface wlan0 inet dhcp                                                   
  34. #        wpa-essid some-essid                                          
  35. #        wpa-psk My-PlainText-Password                                             
  36. #
  37. # A WPA1 or WPA2 encrypted connection using an external configuration file
  38. # for wpa-supplicant. This is the way to go if you need to configure multiple
  39. # networks with different keys and / or WPA settings and roaming support.
  40. #
  41. # iface wlan0 inet dhcp
  42. #    wpa-conf /etc/wpa_supplicant.conf
  43. #    wpa-driver hostap



  44. iface atml0 inet dhcp

  45. # Wired or wireless interfaces
  46. auto eth0
  47. iface eth0 inet static
  48.         address 192.168.1.22
  49.         netmask 255.255.255.0
  50.         gateway 192.168.1.1

  51. #iface eth0 inet dhcp
  52. iface eth1 inet dhcp

  53. # Ethernet/RNDIS gadget (g_ether)
  54. # ... or on host side, usbnet and random hwaddr
  55. iface usb0 inet static
  56.         address 192.168.0.202
  57.         netmask 255.255.255.0
  58.         network 192.168.0.0
  59.         gateway 192.168.0.200


  60. # Zaurus 2.4 Lineo net_fd; obsolete
  61. iface usbd0 inet static
  62.         address 192.168.129.201
  63.         netmask 255.255.255.0
  64.         network 192.168.129.0
  65.         gateway 192.168.129.200

  66. # iPAQ 2.4 mach-sa1100/usb-eth
  67. # (192.168.0.202 is the iPAQ's IP, 192.168.0.200 is the host's IP)
  68. iface usbf inet static
  69.         address 192.168.0.202
  70.         netmask 255.255.255.0
  71.         network 192.168.0.0
  72.         gateway 192.168.0.200

  73. # Bluetooth networking
  74. iface bnep0 inet dhcp
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP