sed常用操作

Standard

删除配置文件中#号注释行

sed 's#\#.*##' file.conf > file.new.conf

删除配置文件中//号注释行

sed 's#//.*##' file.conf > file.new.conf

删除无内容空行

sed '/^$/d' file.conf > file.new.conf

删除由空格和Tab而成的空行

sed '/^[[:space:]]*$/d' file.conf > file.new.conf

删除网站copy源码中的行号

sed -e 's/^ *[0-9]+ (.*)/1/g' file.conf > file.new.conf

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.