cat a.txt | grep -E "过滤字符"

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


例:cat /proc/partitions

结果为

image.png

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

image.png