{"id":773,"date":"2019-04-23T22:11:57","date_gmt":"2019-04-23T14:11:57","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=773"},"modified":"2022-05-16T15:51:37","modified_gmt":"2022-05-16T07:51:37","slug":"cut","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/cut","title":{"rendered":"cut\u547d\u4ee4 – \u6309\u5217\u63d0\u53d6\u6587\u4ef6\u5185\u5bb9"},"content":{"rendered":"\n

cut\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u6309\u5217\u63d0\u53d6\u6587\u4ef6\u5185\u5bb9\u3002\u5e38\u7528\u7684grep\u547d\u4ee4\u4ec5\u80fd\u5bf9\u5173\u952e\u8bcd\u8fdb\u884c\u6309\u884c\u63d0\u53d6\u8fc7\u6ee4\uff0c\u800ccut\u547d\u4ee4\u5219\u662f\u53ef\u4ee5\u6839\u636e\u6307\u5b9a\u7684\u5173\u952e\u8bcd\u4fe1\u606f\uff0c\u9488\u5bf9\u7279\u5b9a\u7684\u5217\u5185\u5bb9\u8fdb\u884c\u8fc7\u6ee4\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>cut [\u53c2\u6570] \u6587\u4ef6<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a\ufeff<\/strong><\/p>\n\n\n\n

-c<\/td>\u4ee5\u5b57\u7b26\u4e3a\u5355\u4f4d\u8fdb\u884c\u5206\u5272 <\/td><\/tr>
-b<\/td>\u4ee5\u5b57\u8282\u4e3a\u5355\u4f4d\u8fdb\u884c\u5206\u5272 <\/td><\/tr>
-d<\/td>\u81ea\u5b9a\u4e49\u5206\u9694\u7b26\uff0c\u9ed8\u8ba4\u4e3a\u5236\u8868\u7b26”TAB” <\/td><\/tr>
-f<\/td>\u663e\u793a\u6307\u5b9a\u5b57\u6bb5\u7684\u5185\u5bb9<\/td><\/tr>
-n<\/td>\u53d6\u6d88\u5206\u5272\u591a\u5b57\u8282\u5b57\u7b26<\/td><\/tr>
--complement<\/td>\u8865\u8db3\u88ab\u9009\u62e9\u7684\u5b57\u8282\u3001\u5b57\u7b26\u6216\u5b57\u6bb5<\/td><\/tr>
--out-delimiter<\/td>\u6307\u5b9a\u8f93\u51fa\u5185\u5bb9\u662f\u7684\u5b57\u6bb5\u5206\u5272\u7b26<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u4ee5\u5192\u53f7\u4e3a\u95f4\u9694\u7b26\uff0c\u4ec5\u63d0\u53d6\u6307\u5b9a\u6587\u4ef6\u4e2d\u7b2c\u4e00\u5217\u7684\u5185\u5bb9\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# cut -d : -f 1 \/etc\/passwd<\/strong>\r\nroot\r\nbin\r\ndaemon\r\nadm\r\nlp\r\nsync\r\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n\n\n\n

\u4ec5\u63d0\u53d6\u6307\u5b9a\u6587\u4ef6\u4e2d\u6bcf\u884c\u7684\u524d4\u4e2a\u5b57\u7b26\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# cut  -c 1-4 \/etc\/passwd<\/strong>\nroot\nbin:\ndaem\nadm:\nlp:x\nsync\nshut\nhalt\nmail\n\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n","protected":false},"excerpt":{"rendered":"

cut\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u6309\u5217\u63d0\u53d6\u6587\u4ef6\u5185\u5bb9\u3002\u5e38\u7528\u7684grep\u547d\u4ee4\u4ec5\u80fd\u5bf9\u5173\u952e\u8bcd\u8fdb\u884c\u6309\u884c\u63d0\u53d6\u8fc7\u6ee4\uff0c\u800ccut\u547d\u4ee4\u5219\u662f\u53ef\u4ee5\u6839 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/773"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=773"}],"version-history":[{"count":8,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/773\/revisions"}],"predecessor-version":[{"id":9728,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/773\/revisions\/9728"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}