My solution with AWK and sed, faster than only AWK


  • 0
    L

    awk '{for(i=1; i<=NF;i++){line[i] = line[i]" "$i}} END{for(i=1;i<=NF;i++){print line[i]}}' file.txt |sed 's/^\ //g'


Log in to reply
 

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