Home >Operation and Maintenance >Linux Operation and Maintenance >What are the methods to prevent the output of linux grep from breaking new lines?

What are the methods to prevent the output of linux grep from breaking new lines?

王林
王林Original
2019-11-14 09:44:585902browse

What are the methods to prevent the output of linux grep from breaking new lines?

Environment:

RedHat

Originally, the output of ps -ef will not wrap lines, but ps -ef | grep java will change the line.

If you want the grep results to not have new lines, there are two methods.

Solution:

(1) Splice less -S:

ps -ef | grep java | less -S

(2) Use tput

tput rmam  # 关闭换行
tput smam  # 打开换行

Recommended tutorial: Linux tutorial

The above is the detailed content of What are the methods to prevent the output of linux grep from breaking new lines?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn