Skip to content
Advertisement

Bash – format .txt file into pover pivot form

txt file called without_Commas.txt. The content looks like this:

JavaScript

I need to format this data to look like this:

JavaScript

Is there a way to do this?

Kind Regards Elias

Advertisement

Answer

JavaScript

On each line, this loops over all the field numbers starting with the third field. Then it prints the first field ($1) followed by the current field in the loop ($i).

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