My gawk solution


  • -1
    I

    gawk 'BEGIN{FS="\n";RS="";ORS=""} {lines[1]="";for(i=1;i<=NF;i++){count=split($i,var,/ /);for(j=1;j<=count;j++){lines[j]=lines[j]" "var[j];}}for(v in lines){print substr(lines[v],2)"\n";}}' file.txt


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.