Skip to content
Advertisement

How to resize the block of a column

I have a single column of a file having many blocks and the blocks are separated by the > symbol.

I want to resize all blocks to the same highest length by appending zero below them.

My file is given below:

file.txt

JavaScript

and my expected output is given below

JavaScript

I am trying to write a script, but it fails:

JavaScript

Advertisement

Answer

Based on your shown samples, could you please try following. Written and tested with shown samples in GNU awk.

JavaScript

For shown samples output will be as follows.

JavaScript

Explanation: Adding detailed explanation for above.

JavaScript
Advertisement