区分文件和目录: ls -F ls -F -R:递归显示目录 仅改变文件的修改时间,而不修改文件的内容: touch filename: 使用 file 命令查看文件类型: ASCII text directory shell script 0. 常用 tricks 仅显示目录 ls -l | grep "^d":以 d 开头 ls -F | grep "/$":以 / 结尾 cd cd -:上次的目录: cd !$:上次命令参数中的最后一个目录: cd !^:上次
grep的用法首先创建我们练习grep命令时需要用到的demo文件demo_file. $ cat demo_file THIS LINE IS THE 1ST UPPER CASE LINE IN THIS FILE. this line is the 1st lower case line in this file. This Line Has All Its First Character Of The Word With Upper Case. Two lines above this
grep 见链接:http://www.cyberciti.biz/faq/grep-regular-expressions/ sed參考文章:http://www.thegeekstuff.com sed工作原理 This is called as one execution cycle. Cycle continues till end of file/input is reached: 1. Read a entire line from stdin/file. 2. Removes an
先说明语系对正则表达式的影响 LANG=C:0,1,2,3,4...A,B,C,D...Z a b c d ... z LANG=zh_CN:0,1,2,3,4...a A b B c C d D... z Z因为不同语系用[a-z]筛选的不同,所以出现了特殊符号[:alnum:] : 即0-9,a-z,A-Z,英文大小写字符和数字,[:alpha:] : 即a-z,A-Z,任何英文大小写字符[:digit:] : 即0-9,所有数字[:upper:] :
grep/egrep 主要作用:给搜索过滤出来的内容加上颜色和排除功能 常用参数 -V 打印grep的版本号 -E 解释PATTERN作为扩展正则表达式,也就相当于使用egrep. 或操作 -F 解释PATTERN作为固定字符串的列表,由换行符分隔,其中任何一个都要匹配.也就相当于使用fgrep. -G 将范本样式视为普通的表示法来使用.这是默认值.加不加都是使用grep. -A num 匹配到搜索到的行以及该行下面的num行 -B num 匹配到搜索到的行以及该行上面的num行 -C num