Treat Two Column as One
by blueray from LinuxQuestions.org on (#527D8)
Sample Text:
Code:$ cat X
Birth Death Name
02/28/42 07/03/69 Brian Jones
11/27/42 09/18/70 Jimi Hendrix
11/19/43 10/04/70 Janis Joplin
12/08/43 07/03/71 Jim Morrison
11/20/46 10/29/71 Duane AllmanAfter Processing With Perl:
Code:$ perl -lae 'print "$F[2]_$F[3] $F[0]"' X | column -t | sed 's/_/ /g'
Name Birth
Brian Jones 02/28/42
Jimi Hendrix 11/27/42
Janis Joplin 11/19/43
Jim Morrison 12/08/43
Duane Allman 11/20/46This is the exact output I want. But the issue is, I do not want to use Code: column -t | sed 's/_/ /g' at the end.
My intuition is that this can be done only with perl (without the need of sed or column).
Is it possible? How can I do that?


Code:$ cat X
Birth Death Name
02/28/42 07/03/69 Brian Jones
11/27/42 09/18/70 Jimi Hendrix
11/19/43 10/04/70 Janis Joplin
12/08/43 07/03/71 Jim Morrison
11/20/46 10/29/71 Duane AllmanAfter Processing With Perl:
Code:$ perl -lae 'print "$F[2]_$F[3] $F[0]"' X | column -t | sed 's/_/ /g'
Name Birth
Brian Jones 02/28/42
Jimi Hendrix 11/27/42
Janis Joplin 11/19/43
Jim Morrison 12/08/43
Duane Allman 11/20/46This is the exact output I want. But the issue is, I do not want to use Code: column -t | sed 's/_/ /g' at the end.
My intuition is that this can be done only with perl (without the need of sed or column).
Is it possible? How can I do that?