Thank you so much. It really helped me. Now i have a few additional requirements to be implemented.I am trying to write but i am not getting result as expected. The requirements are:
1) I have a few input files in directory /tmp/fruits with the content of the files as given below:
# this is a new file
{
date 14/07/2016
time 11:15
end 11:20
total 30
No "FRUITS"
Fruit_Class
{
Name "fruit 1"
fruitName "apple.fru"
fruitId "0"
fruitCount 5
fruitValue 6
}
{
Name "fruit 2"
fruitName "orange.fru"
fruitId "1"
fruitCount 10
fruitValue 20
}
}
I have to read each file from the directory and process the data and write the result to separate output files which looks like
# this is a new file
{date 14/07/2016
time 11:15
end 11:20
total 30
No FRUITS
Fruit_Class
{
Name fruit_1
fruitId 0
apple_fru.fruitCount 5
fruitValue 6
}
Fruit_Class
{
Name fruit_2
fruitId 1
orange_fru.fruitCount 10
fruitValue 20
}
}
The fruit_Class has to be added at the beginning of each
{}.How can i each achieve this.I have to use hash(key,value) concept. Any help would be much appreciated.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.