让 Linux grep 的输出不换行

在Redhat中亲测。

本来ps -ef的输出是不会换行的,但是 ps -ef | grep java 就换行了。

如果想让grep完的结果不要换行,找到两种方法。

1. 在后面拼接 less -S:

ps -ef | grep java | less -S

2. 使用 tput   

tput rmam  # 关闭换行

tput smam  # 打开换行

猜你喜欢

转载自www.cnblogs.com/pekkle/p/9947962.html
今日推荐