复制/etc/profile至/tmp/目录,用查找替换命令删除/tmp/profile文件中的 行首的空白字符

[root@centos6 ~]#cp /etc/profile /tmp/
[root@centos6 ~]#ll /tmp/profile 
-rw-r--r-- 1 root root 1841 Jun 28 20:19 /tmp/profile

将文件复制过来之后,用vim编辑文件

[root@centos6 ~]#vim /tmp/profile 

 利用正则表达式将行首的空白格式显示出来

:/^[[:blank:]]+ 

 此时我们已经能够非常明显的看到行首的空白符

接下来继续将空白格式给替换成空

:%s@^[[:blank:]]+@@g

结束

原文地址:https://www.cnblogs.com/qianyuezhan/p/13204935.html