Skip to content
Advertisement

Separate Text file to columns by ;

Please I have a text file separated by spaces. I would like to output it to columns separated by ;

example Input

JavaScript

I use this code

JavaScript

My output

JavaScript

Output desired.

JavaScript

Appreciate your help.

Advertisement

Answer

JavaScript

$1=$1 is a trick to rebuild $0 with the new separator OFS=';'.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement