To extract data in the format

Hi,

I want to extract the data in the below format from the test case.

Test Case:

module core_pm_1
.
.
sgcmos  ip_name( A(.a))
endmodule

result:

 core_pm_1/ ip_name/A

can you please guide me, how I can achieve the result in the above format.

welcome to the community @priya_joshi.
As always at this forum, provide the small representative sample of the input data - the one that would allow the YOU (and us) to thoroughly test any potential solution.

No .... for "missing data", small, but set of data covering any edge cases, e.g. in you case does input contain multiple "module" blocks, etc...

Also, as always post your sample input/output data and any personal attempts at solving your issue using markdown code tags. The description of these "markdown code tag" are linked in the welcome page of the forum portal.

And more importantly, please share any of your own attempts at solving the issue - this will "guide us" at helping you.

2 Likes

Hi,

yes the code has multiple modules.
I tried the following commands:

awk 'BEGIN ( FS="sgcmos" ) {print 2} practice_file'
grep sgcmos practice_file >>output_file

Thanks & regards
Priya_joshi

You should show (as previously requested) an example of the input containing at least two different examples of a module block.

You should show the results of your attempted commands, and attempt to repair any syntax errors.

If the code appears to hang, it is probably waiting tor data on stdin, instead of reading the file as you expect. Type a couple of random lines (hello and goodbye for example), then Ctrl-D to end the input. Observe and understand the response.

You probably need to investigate what the FS variable actually does.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.