ATTENTION! I have changed the RegEx and sample data so some answers could be wrong! I apologize if doing this is bad practice.
I used grep (online tool) to extract a list of data where repeated parts are sometimes substituted with hyphens (-o flag). The numbers are always 8 digits. There may be more 8-digit numbers following these
RegEx used was: [0-9]{8}(, -[0-9]*)*(, [0-9]{8})*
Sample data below:
33520470
33520850, -60, -70, -80, -90, 33630077
25453810
13815206, -07, -08, 60682651, 60709994
13340820
61040146, -55
60819060, -79
60819088
And my desired output would be:
33520470
33520850
33520860
33520870
33520880
33520890
33630077
25453810
13815206
13815207
13815208
60682651
60709994
13340820
61040146
61040155
60819060
60819079
60819088
Could this be done with grep? If not, could you suggest any unix or other tools to achieve this result? I was thinking sed or awk.
EDIT: This has been solved. I will include the correct command here just for convenience to skip having to dig through the comments:
-F ', ' '{ print $1; for(a=2;a <= NF; a ++){ if(length($a) <= 7){ printf("%s%s\n",substr($1,1,length($1)-(length($a)-1)),substr($a, 2))} else { print $a } } }'