设置关键字颜色转换例:alias grep=‘grep --color=auto’
grep命令:
grep ‘root’ filename过滤文件中包含root的行
grep -n ‘root’ filename过滤文件中包含root的行并且包含行号
grep -ni ‘root’ filename过滤文件中包含root的行并且包含行号(不区分大小写)
grep -niv ‘root’ filename过滤文件中不包含root的行并且包含行号(不区分大小写)
grep -n ‘^root’ filename 过滤文件中root开头的数据并且包含行号
grep -n ‘rootKaTeX parse error: Double superscript at position 503: …s.txt |tr -s ' '̲ '\n' |sed -n '…/!p’|sort|uniq -c|sort -r|awk ‘{print $2,$1}’
查询俩个目录下不同的文件
touch dir1/file{1…5}
touch dir2/file{1…3}
paste file1 file2 合并文件里面的所有内容
paste -d ‘,’ file1 file2 使用分隔符吧文件给合并
paste -s file1 file2 串行处理,
例如:a文件有3条数据,b文件有2条数据,
串行合并完成后只有2条数据
tr工具的使用:
tr ‘a-z’ ‘A-Z’ <1.txt将文件中的小写字母换成大写字母
替换文件中内容:
tr ‘#’ ‘,’ <1.txt 将文件中的#号改成,号
tr删除文件中的字符:
tr -d ‘a-z’ <1.txt 删除文件中的小写字母。
tr -s ‘a-z’ 1.txt 压缩文件中连续字符。
linux过滤切分命令
最新推荐文章于 2024-02-02 22:40:20 发布