You're replying to a comment by Anirudh.

Anirudh Permalink
February 01, 2016, 14:43

In plain sed, it can be done like as shown below:



   s/^//; trst

   # add 100 to a 4-digit number enclosed in \n
   s/\(\n[0-9]\)[0]/\11/; ta
   s/\(\n[0-9]\)[1]/\12/; ta
   s/\(\n[0-9]\)[2]/\13/; ta
   s/\(\n[0-9]\)[3]/\14/; ta
   s/\(\n[0-9]\)[4]/\15/; ta
   s/\(\n[0-9]\)[5]/\16/; ta
   s/\(\n[0-9]\)[6]/\17/; ta
   s/\(\n[0-9]\)[7]/\18/; ta
   s/\(\n[0-9]\)[8]/\19/; ta
   s/\(\n\)[0][9]/\110/;  ta
   s/\(\n\)[1][9]/\120/;  ta
   s/\(\n\)[2][9]/\130/;  ta
   s/\(\n\)[3][9]/\140/;  ta
   s/\(\n\)[4][9]/\150/;  ta
   s/\(\n\)[5][9]/\160/;  ta
   s/\(\n\)[6][9]/\170/;  ta
   s/\(\n\)[7][9]/\180/;  ta
   s/\(\n\)[8][9]/\190/;  ta
   s/\(\n\)[9][9]/\100/;  ta

   s/^/\n/; D


Or, with perl you could do:

perl -lpe 's/\b(\d\d)(?=\d\d\b)/int(($1+1)\/100)-1?$1+1:"00"/eg'

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "server_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.