\u9996\u5148\uff0c\u6211\u4eec\u521b\u5efa\u53e6\u4e00\u4e2a\u793a\u4f8b\u6587\u4ef6 sed-demo-1.txt \u8fdb\u884c\u66f4\u597d\u5730\u6f14\u793a\uff0c\u5176\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n
# cat sed-demo-1.txt\r\n\r\nAfter deletion:\r\nLinux Operating System\r\nUnix Operating System\r\nRHEL\r\nRed Hat\r\nFedora\r\ndebian\r\nubuntu\r\nArch Linux - 1\r\n2 - Manjaro\r\n3 4 5 6<\/pre>\n\u4e0a\u9762\u4e5f\u5df2\u7ecf\u63d0\u5230\u8fc7\uff0c$ \u53f7\u53ef\u4ee5\u7406\u89e3\u4e3a\u7ed3\u5c3e\uff0c\u90a3\u4e48\u6709\u6ca1\u6709\u5b57\u7b26\u53ef\u4ee5\u4ee3\u8868\u5f00\u5934\u5462\uff1f\u7b54\u6848\u662f\u6709\u7684\uff0c\u8fd9\u91cc\u6211\u4eec\u53ef\u4ee5\u7528 ^ \u53f7\u4ee3\u8868\u5f00\u5934\u3002<\/p>\n
\u90a3\u4e48\uff0c\u6211\u4eec\u60f3\u8981\u5220\u9664\u4ee5\u67d0\u4e00\u4e2a\u5b57\u7b26\u5f00\u5934\u7684\u884c\u65f6\uff0c\u6bd4\u5982\u8bf4\u5220\u9664\u4ee5 R \u5f00\u5934\u7684\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n
# sed '\/^R\/d' sed-demo-1.txt\r\n\r\nAfter deletion:\r\nLinux Operating System\r\nUnix Operating System\r\nFedora\r\ndebian\r\nubuntu\r\nArch Linux - 1\r\n2 - Manjaro\r\n3 4 5 6<\/pre>\n\u90a3\u4e48\u95ee\u9898\u6765\u4e86\uff0c\u6bd4\u5982\u6211\u60f3\u5220\u9664\u4ee5 R \u6216\u8005 F \u5f00\u5934\u7684\u884c\uff0c\u90a3\u6211\u662f\u4e0d\u662f\u8981\u6267\u884c\u4e24\u6b21\u547d\u4ee4\u5462\uff1f\u5982\u679c\u662f\u6709\u66f4\u591a\u5c82\u4e0d\u662f\u8981\u6267\u884c\u591a\u6b21\u547d\u4ee4\uff1f\u8fd9\u91cc\u5b83\u6709\u4e00\u4e2a\u7b80\u5355\u7684\u5199\u6cd5\uff0c\u4f60\u53ea\u8981\u628a\u8fd9\u4e9b\u5b57\u7b26\u5199\u5728\u4e00\u5bf9\u4e2d\u62ec\u53f7 [] \u91cc\u5c31\u53ef\u4ee5\u4e86\uff1a<\/p>\n
# sed '\/^[RF]\/d' sed-demo-1.txt\r\n\r\nAfter deletion:\r\nLinux Operating System\r\nUnix Operating System\r\ndebian\r\nubuntu\r\nArch Linux - 1\r\n2 - Manjaro\r\n3 4 5 6<\/pre>\n\u4e0a\u9762\u547d\u4ee4\u7684\u4f5c\u7528\u662f \u5220\u9664\u4ee5 R \u6216\u8005 F \u5f00\u5934\u7684\u884c\u3002<\/p>\n
6. \u5220\u9664\u7279\u5b9a\u5b57\u7b26\u7ed3\u5c3e\u7684\u884c<\/strong><\/div>\n\u540c\u4e0a\u9762\u4e00\u4e2a\u9053\u7406\uff0c\u5220\u9664\u4ee5\u67d0\u4e00\u4e2a\u5b57\u7b26\u7ed3\u5c3e\u7684\u884c\uff0c\u6bd4\u65b9\u8bf4\u5220\u9664\u4ee5 m \u7ed3\u5c3e\u7684\u884c\uff0c\u6211\u4eec\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a<\/p>\n
# sed '\/m$\/d' sed-demo.txt\r\n\r\nAfter deletion:\r\n3 RHEL\r\n4 Red Hat\r\n5 Fedora\r\n6 Arch Linux\r\n7 CentOS\r\n8 Debian\r\n9 Ubuntu\r\n10 openSUSE<\/pre>\n\u5220\u9664\u4ee5 x \u6216 m \u7ed3\u5c3e\u7684\u884c\u53ef\u4ee5\u8fd9\u6837\u5199\uff1a<\/p>\n
# sed '\/[xm]$\/d' sed-demo.txt\r\n\r\nAfter deletion:\r\n\r\n3 RHEL\r\n4 Red Hat\r\n5 Fedora\r\n7 CentOS\r\n8 Debian\r\n9 Ubuntu\r\n10 openSUSE<\/pre>\n7. \u5220\u9664\u4ee5\u5927\u5199\u5b57\u6bcd\u5f00\u5934\u7684\u884c<\/strong><\/div>\n\u8fd9\u91cc\u95ee\u9898\u53c8\u6765\u4e86\uff0c\u6211\u60f3\u8981\u5220\u9664\u6240\u6709\u4ee5\u5927\u5199\u5b57\u6bcd\u5f00\u5934\u7684\u884c\u5462\uff1f\u6309\u7167\u4e0a\u9762\u7684\u505a\u6cd5\u662f\u4e0d\u662f\u8981\u5c06 A \u5230 Z \u8fd9 26 \u4e2a\u5b57\u6bcd\u90fd\u5199\u8fdb [ ] \u91cc\u5462\uff1f\u5176\u5b9e\u6211\u4eec\u5927\u53ef\u4e0d\u5fc5\u8fd9\u6837\u505a\uff0c\u5728 A \u548c Z \u4e2d\u95f4\u52a0\u4e2a - \u5c31\u53ef\u4ee5\u4e86\uff1a<\/p>\n
# sed '\/^[A-Z]\/d' sed-demo-1.txt\r\n\r\nAfter deletion:\r\ndebian\r\nubuntu\r\n2 - Manjaro\r\n3 4 5 6\r\n\u673a\u667a\u7684\u4f60\u770b\u5230\u8fd9\u91cc\u80af\u5b9a\u4f1a\u60f3\u5230\u5176\u4ed6\u7c7b\u4f3c\u7684\u7528\u6cd5\u7684\u4e86\uff0c\u4e0d\u59a8\u770b\u770b\u4e0b\u9762\u662f\u5426\u6709\u4f60\u60f3\u5230\u7684\u547d\u4ee4\u5427\u3002\r\n<\/pre>\n8. \u5220\u9664\u5305\u542b\u5b57\u6bcd\u5b57\u7b26\u7684\u884c<\/strong><\/div>\n# sed '\/[A-Za-z]\/d' sed-demo-1.txt\r\n\r\nAfter deletion:\r\n3 4 5 6<\/pre>\n9. \u5220\u9664\u5305\u542b\u6570\u5b57\u7684\u884c<\/strong><\/div>\n# sed '\/[0-9]\/d' sed-demo-1.txt\r\n\r\nAfter deletion:\r\n\r\nLinux Operating System\r\nUnix Operating System\r\nRHEL\r\nRed Hat\r\nFedora\r\ndebian\r\nubuntu<\/pre>\n\u53e6\u5916\uff0c\u901a\u8fc7\u8fd9\u4e2a\u4f8b\u5b50\uff0c\u6211\u4eec\u53ef\u4ee5\u52a0\u4e0a ^ \u548c $ \u66f4\u597d\u5730\u770b\u5230\u4ed6\u4eec\u4e09\u4e2a\u4e4b\u95f4\u7684\u533a\u522b\uff1a<\/p>\n
# sed '\/^[0-9]\/d' sed-demo-1.txt\r\n\r\nAfter deletion:\r\n\r\nLinux Operating System\r\nUnix Operating System\r\nRHEL\r\nRed Hat\r\nFedora\r\ndebian\r\nubuntu\r\nArch Linux - 1\r\n# sed '\/[0-9]$\/d' sed-demo-1.txt\r\n\r\nAfter deletion:\r\n\r\nLinux Operating System\r\nUnix Operating System\r\nRHEL\r\nRed Hat\r\nFedora\r\ndebian\r\nubuntu\r\n2 - Manjaro<\/pre>\n10. \u5176\u4ed6\u66f4\u591a<\/strong><\/div>\n\u5b9e\u9645\u4e0a\uff0c\u6211\u4eec\u8981\u5220\u9664\u7684\u6587\u4ef6\u5185\u5bb9\u662f\u66f4\u4e3a\u5177\u4f53\u7684\uff0c\u7b80\u5355\u7684\u6761\u4ef6\u662f\u6ee1\u8db3\u4e0d\u4e86\u6211\u4eec\u7684\u9700\u6c42\u7684\uff0c\u6240\u4ee5\uff0csed \u4e5f\u652f\u6301\u66f4\u590d\u6742\u7684\u6761\u4ef6\u7ec4\u5408\u3002\u6bd4\u65b9\u8bf4\u6211\u8981\u6307\u5b9a\u5220\u9664\u5728 1 \u5230 6 \u884c\u5185\u6709 Linux \u8fd9\u4e2a\u8bcd\u7684\u5185\u5bb9\uff0c\u90a3\u4e48\uff1a<\/p>\n
# sed '1,6{\/Linux\/d;}' sed-demo.txt\r\n\r\nAfter deletion:\r\n2 Unix Operating System\r\n3 RHEL\r\n4 Red Hat\r\n5 Fedora\r\n7 CentOS\r\n8 Debian\r\n9 Ubuntu\r\n10 openSUSE<\/pre>\n\u5220\u9664\u5305\u542b System \u4ee5\u53ca\u5176\u4e0b\u4e00\u884c\u7684\u5185\u5bb9\uff1a<\/p>\n
# sed '\/System\/{N;d;}' sed-demo.txt\r\n\r\nAfter deletion:\r\n3 RHEL\r\n4 Red Hat\r\n5 Fedora\r\n6 Arch Linux\r\n7 CentOS\r\n8 Debian\r\n9 Ubuntu\r\n10 openSUSE<\/pre>\n","protected":false},"excerpt":{"rendered":"ed \u662f Stream Editor \u7684\u7b80\u5199\uff0c\u5b83\u7528\u4e8e\u5728 Linux \u4e2d\u8fdb\u884c\u57fa\u672c\u7684\u6587\u672c\u8f6c\u6362\uff0c\u662f\u6587\u4ef6\u64cd\u4f5c\u7684\u4e00\u4e2a\u91cd\u8981 […]<\/p>\n","protected":false},"author":1469,"featured_media":199600,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-199592","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/199592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=199592"}],"version-history":[{"count":10,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/199592\/revisions"}],"predecessor-version":[{"id":199612,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/199592\/revisions\/199612"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/199600"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=199592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=199592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=199592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}