Mar 25, 2013, 4:13 PM
Post #2 of 4
Hmm, don't take it as an offense, but this forum is really a place to ask help if you are trying to do something in Perl and are encountering problems doing it, it is not a bureau to write free programs for you.
Re: [yash1709] Extracting data and inputting to a file in certain format
[In reply to]
If you want to hire someone to do the work for you, you may look at this page: http://perlguru.com/gforum.cgi?forum=19;
Just an example on how you could do what you want. If you have the following line:
static const data16 HEAD_SELECT = 0x000F; // <3:0> - RW
and want to write:
set SymList [list [list HEAD_SELECT [list 0 0x000F 0]] \
I'll assume that you want to use the 0x000F value of the first line to populate the value un the second line. This could be done with something like this (assuming you input line above is stored in the $line variable):
$head_select = $1 if $line =~ /HEAD_SELECT = (0x\w+);/;
print "set SymList [list [list HEAD_SELECT [list 0 $head_select 0]] \\\n";
You just have to do something like this for all cases, and you are done. Pretty simple, isn't it?
Or may be it does not look simple at all to you. If it looks like mumbo jumbo to you, then we are back to what I was saying at the beginning: may be you should hire someone to do the job and pay that person. It would probably take me just a few hours to do the work, so it would not necessarily be very expensive (but let me be clear, I am a feelance consultant, but I am emphatically not offering my services to do it, I have enough work to fill my day for the time being).
As an additional comment, I must say that you are very very far from giving enough details on how one should use the data from your input file to derive the data to be inserted in your output file. Just for the sample line that coded above, there are many more things derived from my assumptions on or my understanding of what you need than from your description of what you need. You've got to be much more precise and detailed in your specs or bill of requirements.
So, if you find someone to do the work, you'll have do describe much more precisely what you need. No one can write a program and hope to be right just from the example you gave.