I have a file with about 10k lines. I would like to prependadd the line numbers to the first column, but in such a way as to repeat the prependedline numbers 1 for the first 100 lines of input data, then prepend the 2 to the second 100 lines, and so on-100.
Example input: For example,
1 12313
2 3434
4233
< 96 more lines of numbers.
.
.
100 >4233
1 24523
< 97 more lines of numbers... >
4543543
.
.
.
Example output:
1 12313
1100 34344543543
1 4233
< 96 more lines of numbers... >
2 24523.
< 97 more. lines of numbers... >
2 4543543
3 < ...etc>100
How could I do it using grepgrep or awkawk?
Using awk, I managed to print the line numbers, but without any repeating: using awk
awk '{ print NR, $1 }' p2.dat > p3.dat