首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
【
分享:shell去掉linux配置文件的注释行
】的更多相关文章
分享:shell去掉linux配置文件的注释行
如何通过shell去掉Linux配置文件中的注释行呢? 本文给出两种解决方法,供大家参考. 方法1.使用grep -v "^#" 来去掉注释行,其中:-v 表示取反 ^# 表示注解行 grep -v "^#" /etc/vsftpd/vsftpd.conf (使用“>”来重写配置文件也是可以的) 方法2.连同空行一起去掉,使用管道符.(^$表示空行 ) grep -v "^#" httpd.conf | grep -v "^$&q…
如何去掉linux配置文件的注释行和空行
1.使用grep -v "^#" 来去掉注释行,其中:-v 就是取相反的 ^# 表示以#开头的行 eg. grep -v "^#" /etc/vsftpd/vsftpd.conf (也可以使用">"来重写配置文件) 2.有时也会连同空行一起去掉,使用管道符来完成(^$表示空行 ) eg. grep -v "^#" httpd.conf | grep -v "^$" >> vs…
grep命令:查看配置文件未注释行(转)
FROM: https://linux.cn/article-6958-1.html 可以使用 UNIX/BSD/OS X/Linux 这些操作系统自身提供的 grep,sed,awk,perl或者其他文本处理工具来查看配置文件中的有效配置命令行. grep -v "^#" /etc/apache2/apache2.conf 想要跳过其中的空行,可以使用 egrep 命令, 示例: egrep -v "^#|^$" /etc/apache2/apache2.conf…
老李分享:《Linux Shell脚本攻略》 要点(四)
老李分享:<Linux Shell脚本攻略> 要点(四) 1.IP地址的正则表达式: [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} 2.grep用法 //在多级目录中对文本进行递归检索 [root@localhost program_test]# grep "yang" ./ -Rn ./test.txt:6:laoyang./right.txt:1:1 yang man //忽略大小写匹配 [root@localhost…
老李分享:《Linux Shell脚本攻略》 要点(二)
老李分享:<Linux Shell脚本攻略> 要点(二) poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课程感兴趣,请大家咨询qq:908821478.Linuxshell是测试开发工程师的基本功之一,所以在poptest测试开发课堂上加入了大量的linuxshell的课程,为了学员开发跨平台的测试平台打基础. 1.cat cat -s //多个空白行压缩成一个 cat *.txt | tr -s '\n' …
老李分享:《Linux Shell脚本攻略》 要点(八)
老李分享:<Linux Shell脚本攻略> 要点(八) 1.打印进程 [root@localhost program_test]# ps -e | head PID TTY TIME CMD 1 ? 00:00:03 init 2 ? 00:00:00 kthreadd 3 ? 00:00:00 migration/0 4 ? 00:00:00 ksoftirqd/0 5 ? …
老李分享:《Linux Shell脚本攻略》 要点(七)
老李分享:<Linux Shell脚本攻略> 要点(七) 1.显示给定文件夹下的文件的磁盘适用情况 [root@localhost program_test]# du -a -h ./320K ./output.tar96K ./reslt_yang.txt4.0K ./curr_dir.md54.0K ./sed_data.txt 2.总计磁盘大小使用统计 -c [root@localhost program_test]# du -h -c ./48K …
老李分享:《Linux Shell脚本攻略》 要点(六)
老李分享:<Linux Shell脚本攻略> 要点(六) 1.打印网络接口列表 [root@localhost touch_more]# ifconfig | cut -c-10 | tr -d ' ' | tr -s '\n'eth0lo //cut -c-10 ; 输出前10个字符; //tr -d ' ' ; 删除所有空格; //tr -s '\n'; 压缩重复的换行符 2.查看名字服务器 [root@localhost touch_more]# cat /e…
老李分享:《Linux Shell脚本攻略》 要点(五)
老李分享:<Linux Shell脚本攻略> 要点(五) //1.打包.解包 [root@localhost program_test]# tar -cf output.tar 11.txt 22.txt 33.txt [root@localhost program_test]# tar -xf output.tar -C ./tar-file/ //-C指定要提取到哪个路径? //列举出归档文件中的内容 [root@localhost program_test]# tar -tvf o…
老李分享:《Linux Shell脚本攻略》 要点(三)
老李分享:<Linux Shell脚本攻略> 要点(三) 1.生产任意大小的文件 [root@localhost dd_test]#[root@localhost dd_test]# dd if=/dev/zero of=junk.data bs=1k count=1010+0 records in10+0 records out10240 bytes (10 kB) copied, 0.00137023 s, 7.5 MB/s 2.文件系统相关测试 [ -f $file_var ]:…