There are several questions about how to duplicate lines, I want to automatically duplicate each line the specific number of times as found in field one of a file. I have a large file with two fields, field one is a number, field two is the information in question, like this.
12 AAA 18 BBB 25 CCC 33 DDD
I would to duplicate each line so it is represented the same number of times as the number in field one. So, I want 12 lines that say "12 AAA" and so on.
I know that I can manually paste each line x number of times in vim (copy and then "12p") but this seems onerous for a large file. Does anyone know a script that can do it automatically?