复制命令:cp
cp /etc/profile /tmp
/etc/profile是源文件,/tmp是目标目录,具体语法可以参考我另外一篇博客,<<Linux常见文件管理类命令>>,
替换可以用vim进入编辑文件,然后替换,也可以用sed命令,我们这里介绍vim命令
vim /tmp/profile
进入编辑以后,可以用查找命令,查出行首的空白字符
然后再用替换命令替换
格式:s/要查找的内容/替换为的内容/修饰符(这里的斜杠可以用其他符号代替,比如#,@)
全局替换格式:%s/要查找的内容/替换为的内容/g
这里的需求解决方法如下: