I know I can use Awk, but I am on a Windows box, and I am making a function for others that may not have Awk. I also know I can write a C program, but I would love not to have something that requires compilation and maintenance for a little Vim utility I am making.
The original file might be:
THE DAY WAS LONG
THE WAY WAS FAST
and after the transposition, it should become:
TT
HH
EE
DW
AA
YY
WW
AA
SS
LF
OA
NS
GT
Update
- Golf rules apply to selecting correct answer.
- Python fans should check out Charles Duffy’s answer below.