change first line using bash

need to change a single line in a file. It is always in the first line of the file.

It looks like:

htn0   n1  n2  n3  n4  n5  n6  n7  n8  n9  hilu    cjt 1   1000000

there is a tab in all gaps except after the h.

I would need to re-transform the line into

h  n1   n2  n3  n4  n5  n6  n7  n8  n9  
hilu    cjt 1   1000000

at the beginning o the line the t thing and n0 needs to go and there needs to be a tab between h and n1. Then a newline needs to start before hilu but there should be no additional tab after n9

Ideally I would just feed my file to the script and it would not require writing an intermediate script to fill.

is there maybe an efficient version in Perl or python or so? I thought about R but then there are 1000 of lines in the file and only the first lien needs be changed…

Source: bash

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.