requirement is 1. whenever I encounter ce_pr_switch , I goto extract the info which is present in the right side of the -control_port i.e. only the hierarchy (a_top/tp_t_n) for both the control port.. 2. This ce_pr_switch might be in many files, goto check in all files and extract this info alone.

Need help in extracting that info alone !! How to do, its urgent help out..

You might need to escape the '-' at the beginning of the regex, (i.e. to have "/ \- control..."), not sure, I don't have documentation with me and cannot run a test right now (I am in public transportation on cell phone network).

It uses the range operator to process blocks between line that begins with ce_pr_switch TO line that does not begin with - ( may be better to check for lines without backslash on end i.e. /[^\\] (\r|\n)*$/ ). This was to suit your requirement "whenever I encounter ce_pr_switch" assuming that there are multiple blocks per file / will ensure that we do not process isolated -control_port lines.

With regards to "goto check in all files", I can only assume you refer to checking all files across your entire system. File::Find will likely be suitable.

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.

I think I understand your requirements. You want to search the specified directory (and all its subdirectories) for files which contain the desired data. Output selected fields from every matching record.

Input data records span multiple lines. A backslash as the last character indicates that the record is continued on the next line.

Use File::Find to find candidate files. Read logical records from those files. Report data from desired records. Good Luck, Bill