linux sh脚本获取包含指定字符的行
cat a.txt | grep -E "过滤字符"
cat a.txt | grep -E "过滤字符" > b.txt //结果写入b.txt
例:cat /proc/partitions
结果为

只保留包含ram的行 cat /proc/partitions|grep -E 'ram'

cat a.txt | grep -E "过滤字符"
cat a.txt | grep -E "过滤字符" > b.txt //结果写入b.txt
例:cat /proc/partitions
结果为

只保留包含ram的行 cat /proc/partitions|grep -E 'ram'
