regex - break a text file into several blocks with perl -
i have file contains diff output, looks this:
26c26 < or in bright light of morning --- > or in bright light of evning 34c34,36 < clouds roll clear of summits. --- > hello world > came here ask > questions 43,44c45 < how imagine orchid boat? < gets harder. days come , go, --- > don't cry tonigh, 49,50c50,52 < though caught imprisoning moment. < golden leaf in autumn spins dark river --- > che che che che changes. > la la la la la > song i wnat process file block block, twho blocks sepreated delimeter of form:
{number}c{number} example 48c70
or
{number},{number}c{number} example 90,120c70
or
{number},{number}c{number},{number} example 36,40c88,1020
or
{number}c{number},{number} example 99,100c70
for example, file above containes 4 blocks:
block 1:
26c26 < or in bright light of morning --- > or in bright light of evning block 2:
34c34,36 < clouds roll clear of summits. --- > hello world > came here ask > questions block 3:
43,44c45 < how imagine orchid boat? < gets harder. days come , go, --- > don't cry tonigh, block 4:
49,50c50,52 < though caught imprisoning moment. < golden leaf in autumn spins dark river --- > che che che che changes. > la la la la la > song how can using perl?
thank you
Comments
Post a Comment