![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
eclipse_c
游戏程序员
展开
-
【leetcode-shell】Tenth Line
随便找了一个shell脚本的题目。 打印出第十行的内容。 解法一:循环,不过效率最差,排在了最后# Read from the file file.txt and output the tenth line to stdout. #!/bin/bash declare count=0 cat file.txt | while read line do if [ $c原创 2017-06-21 15:01:53 · 246 阅读 · 0 评论 -
sed匹配特殊字段并修改下面某行的实现方法
有个需求需要修改某配置文件,其中有很多相同的字段,无法直接去匹配。例如 [MapServer] #监听地址 host = 127.0.0.1 #监听端口 port = 1107 [IDIPServer] #监听地址 host = 127.0.0.1 #监听端口 port = 1101 [AlarmServer] #监听地址 host = 127.0.0.1 #监听端口 port原创 2018-01-05 10:48:00 · 2290 阅读 · 0 评论