I have a file with about 10k lines. I would like to add the line numbers to the first column, but in a way to repeat the line numbers 1-100. For example,
1 12313
2 3434
.
.
.
100 4233
1 24523
.
.
.
100 4543543
1
.
.
.
100
How could I do it using grep or awk? I managed to print the line numbers, but without repeating using awk
awk '{ print NR, $1 }' p2.dat > p3.dat
awk
code, it seems you wanted to prefix or prepend line numbers in incremented groups, not add numbers to input data.