Home > OS >  Awk how to implement piecewise line turn?
Awk how to implement piecewise line turn?

Time:01-07

Document test. TXT below
A1
B1
C1

A2
B2
C2

A3
B3
C3
Is a blank line between each paragraph
To become
A1 b1 c1
A2 b2 c2
A3 b3 c3
How to implement? Awk can feel, what to write?
All the contents of the transfer line column can be, what to write but section? Not, thank you

CodePudding user response:

Row column, column turned awk '{for (I=0; + + i<=the NF;) A=a [I] [I]? A [I] the FS $I: ${I} END for (I=0; I++ & lt; NF;) Print a [I]} '

CodePudding user response:

I know this command, but the result is a1 b1 c1 a2 b2 c2 a3 b3 c3, the output is a line, does not conform to the requirements,

CodePudding user response:

His back once:
Awk '{the if ($1=="") {print" "}; If ($1!="") {printf $1}} 'test. TXT
So I can
  • Related