获得第n行文本输出

syk*_*ker 23 linux

我有一个脚本,每次生成两行作为输出.我真的只对第二行感兴趣.此外,我只对第二行中#对的文本感兴趣.此外,在哈希之间,使用另一个分隔符:^ A. 如果我还可以拆分^ A分隔的文本的每个部分(注意^ A是SOH特殊字符并且可以使用Ctrl-A键入),那将是很好的

N 1*_*1.1 64

output | sed -n '1p'  #prints the 1st line of output

output | sed -n '1,3p'  #prints the 1st, 2nd and 3rd line of output
Run Code Online (Sandbox Code Playgroud)

  • 你的答案更好.不确定为什么另一个被接受.很混乱. (3认同)

Gru*_*rig 7

your.program | tail +2 | cut -d# -f2 
Run Code Online (Sandbox Code Playgroud)

应该让你2/3的方式.