in reply to Re: how to split file with some pattern
in thread how to split file with some pattern

1. sorry , I should say it more detail. if a blank line in module/endmodule the program you write will stop to run , that is not what I want. please ignore the blank line and let the program continue run until see "endmodule"

2. yes , I hope text in module/endmodule to a new file include module/endmodule.

Thanks !!
  • Comment on Re^2: how to split file with some pattern

Replies are listed 'Best First'.
Re^3: how to split file with some pattern
by blindluke (Hermit) on Jan 23, 2015 at 10:49 UTC

    Good. Now that you have your requirements figured out, try to combine elements of my solution with the suggestions provided by this reply by Discipulus. In particular, ignore the "paragraph mode", start with the while loop suggested by Discipulus, expand the pattern he provided by capturing the desired file name (look at this regexp in my reply: m/^\s*module\s*([A-Za-z]+)/), and finish with writing to files, using either the approach I have show or the one suggested by vinoth.ree.

    Try writing your script, and if you encounter any problems, post your code and we will do our best to help you improve it.

    - Luke

Re^3: how to split file with some pattern
by Discipulus (Canon) on Jan 23, 2015 at 10:23 UTC
    you have the solution in my first reply: you just need to fire @files elemnts in separate files..
    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.