linux 平常笔记

一、test时 -s file FILE exists and has a size greater than zero
  这里说的是文件的大小,新建一个文件即:touch test.txt 经过命令 ls -s test.txt 能够查看到其大小是0
 可是,若是里面写入写入东西再清空,那么其size为4,而不是0。因此-s 不能用来判断文件是否为空 shell

二、LINUX shell 替换第一个匹配的字符串
 sed '/old/{s/old/new/;:skip n;b skip;}' aa.txt spa

相关文章
相关标签/搜索