如何排队在bash包的输出? [英] How to line wrap output in bash?

查看:112
本文介绍了如何排队在bash包的输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有输出以下格式的命令:

  A

C
ð
Ë
F
G
一世
Ĵ


我想输出将在此格式

  A B C D E F G I J

我试着用 ./脚本| TR\\ n,但它的作用是从输出中删除 N
我如何得到所有的输出一行。 (行包)


  

编辑:我不小心把在grep的同时问这个问题。我删除
  它。我原来的问题仍然有效。



解决方案

的grep 是多余的。

这应该工作:

  ./脚本| TR的'\\ n'''

这为我做了一个命令,列出每行的参数之一:

  $人A B C D E F G H I J
一个

C
ð
Ë
F
G
H
一世
Ĵ
$人A B C D E F G H I J | TR的'\\ n'''
A B C D E F G H I J $

I have a command which outputs in this format:

A
B
C
D
E
F
G
I
J

etc I want the output to be in this format

A B C D E F G I J

I tried using ./script | tr "\n" " " but all it does is remove n from the output How do I get all the output in one line. (Line wrapped)

Edit: I accidentally put in grep while asking the question. I removed it. My original question still stands.

解决方案

The grep is superfluous.

This should work:

./script | tr '\n' ' '

It did for me with a command al that lists its arguments one per line:

$ al A B C D E F G H I J
A
B
C
D
E
F
G
H
I
J
$ al A B C D E F G H I J | tr '\n' ' '
A B C D E F G H I J $

这篇关于如何排队在bash包的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆