So while this seemed totally trivial it turned out to be much more difficult than I had thought.
I have a file with 3 rows, and I "just" want to add each field n number of times. E.g.
> cat file.txt
0.5
-0.1
0.6
for n=3 into:
cat newfile.txt
0.5 0.5 0.5
-0.1 -0.1 -0.1
0.6 0.6 0.6
I thought this would be straightforward with awk.
If I didn't need it to be flexible, this works fine:
awk '{print $0 $0 $0}'
My best attempt is probably:
> awk -v n=3 '{ORS=" "}{while (count++<n) print} file.txt > newfile.txt
> cat newfile.txt
0.5 0.5 0.5
this skips line 2 and 3 though
Anyone got the sneaky solution?