{"id":191701,"date":"2020-05-20T11:00:37","date_gmt":"2020-05-20T03:00:37","guid":{"rendered":"https:\/\/gulass.cn\/?p=191701"},"modified":"2020-05-19T09:11:56","modified_gmt":"2020-05-19T01:11:56","slug":"sed","status":"publish","type":"post","link":"https:\/\/gulass.cn\/sed.html","title":{"rendered":"sed\u547d\u4ee4"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | sed \u662f\u4e00\u79cd\u5728\u7ebf\u7f16\u8f91\u5668\uff0c\u5b83\u4e00\u6b21\u5904\u7406\u4e00\u884c\u5185\u5bb9\u3002\u5904\u7406\u65f6\uff0c\u628a\u5f53\u524d\u5904\u7406\u7684\u884c\u5b58\u50a8\u5728\u4e34\u65f6\u7f13\u51b2\u533a\u4e2d\uff0c\u79f0\u4e3a\u201c\u6a21\u5f0f\u7a7a\u95f4\u201d\uff08pattern space\uff09\uff0c\u63a5\u7740\u7528sed\u547d\u4ee4\u5904\u7406\u7f13\u51b2\u533a\u4e2d\u7684\u5185\u5bb9\uff0c\u5904\u7406\u5b8c\u6210\u540e\uff0c\u628a\u7f13\u51b2\u533a\u7684\u5185\u5bb9\u9001\u5f80\u5c4f\u5e55\u3002\u63a5\u7740\u5904\u7406\u4e0b\u4e00\u884c\uff0c\u8fd9\u6837\u4e0d\u65ad\u91cd\u590d\uff0c\u76f4\u5230\u6587\u4ef6\u672b\u5c3e\u3002\u6587\u4ef6\u5185\u5bb9\u5e76\u6ca1\u6709 \u6539\u53d8\uff0c\u9664\u975e\u4f60\u4f7f\u7528\u91cd\u5b9a\u5411\u5b58\u50a8\u8f93\u51fa\u3002Sed\u4e3b\u8981\u7528\u6765\u81ea\u52a8\u7f16\u8f91\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\uff1b\u7b80\u5316\u5bf9\u6587\u4ef6\u7684\u53cd\u590d\u64cd\u4f5c\uff1b\u7f16\u5199\u8f6c\u6362\u7a0b\u5e8f\u7b49\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n \u5c06 \/etc\/passwd \u7684\u5185\u5bb9\u5217\u51fa\u5e76\u4e14\u5217\u5370\u884c\u53f7\uff0c\u540c\u65f6\uff0c\u8bf7\u5c06\u7b2c 2~5 \u884c\u5220\u9664\uff01<\/strong><\/div>\n [root@www ~]# nl \/etc\/passwd | sed '2,5d'\r\n1 root:x:0:0:root:\/root:\/bin\/bash\r\n6 sync:x:5:0:sync:\/sbin:\/bin\/sync\r\n7 shutdown:x:6:0:shutdown:\/sbin:\/sbin\/shutdown\r\n.....(\u540e\u9762\u7701\u7565).....<\/pre>\n |