1 、復制/etc/profile至/tmp/目錄,用查找替換命令刪除/tmp/profile文件中的行首的空白字符
#cp /etc/profile /tmp
#vim /tmp/profile :%s/^[[:space:]]\+//
2 、復制/etc/rc.d/init.d/functions 文件至/tmp 目錄,用查找替換命令為/tmp/functions的每行開頭為空白字符的行的行首添加一個#號
#cp /etc/rc.d/init.d/functions /tmp
#vim /tmp/functions :%s/^[[:space:]]\+/#&/
1 、如何設置tab 縮進為4 個字符?
#vim file :set tabstop=4
2、、刪除/tmp/functions 文件中所有以#開頭,且#后面至少有一個空白字符的行的行首的#號;
#vim /tmp/functions :%s/^#\([[:space:]]\+\)/\1/
不支持擴展正則表達式,例如#vim /tmp/functions :%s/^#([[:space:]]\+)/\1/
原創文章,作者:18612763863,如若轉載,請注明出處:http://www.www58058.com/35546