CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [Laurent_R] How to extract string info from a bigger string: Edit Log

New User

Apr 4, 2013, 12:48 PM

Views: 919
Re: [Laurent_R] How to extract string info from a bigger string

Thanks a lot Laurent & Chris...

The requirement is like,

1. There will be a directory and inside that directory there will be N-number of files and folders.

2. The script basically should search recursively in all files and folders for ce_pr_switch word.

3. The example would be like, as given below:

ce_pr_switch ABCD_EFG_IJK \
-domain ABC_CX \
-input_supply_port { xaz xx_xyxyx_1 } \
-output_supply_port { xbz asdfadfa_123_afdf } \
-control_port { xcz a_top/tp_t_n } \
-control_port { xdz a_top/tp_t_n } \
-on_state { xez d_e { (e_n && e_in) } } \
-off_state { xfz { !(e_in && en_in) } }
* It starts with the word ce_pr_switch and the back slash in the the line basically means that its going to continue in the next line [Basically its a one single line and instead of typing it fully in a single line, its been appended to the next line via a back slash (\).] and at the end of the line there won't be a back slash, indicating that its the end of the line.

4. So, once when it encounters the word called ce_pr_switch, it should check in the next coming lines whether it has control_ports or not.

5. And if it finds any control_port then, extract the hierarchy which is present in the right side of the control_port. For example in the above code it is a_top/tp_t_n

6. It should basically look for the control_ports coming in the line along with ce_pr_switch and look for the hierarchy in the right side.

7. The script should not look in any of the stand alone control_port lines.

8. It basically should print in a output file, as example given below.

File Name Stch Name Control Port
xyz.txt ABCD_EFG_IJK a_top/tp_t_n

As I am totally new to perl, finding it diffucult. Please do the needful help.


In Reply To

(This post was edited by vimo on Apr 4, 2013, 12:49 PM)

Edit Log:
Post edited by vimo (New User) on Apr 4, 2013, 12:49 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives