Hello neeraj_kr,

Welcome to the Monastery. I am bit confused here. I am not sure through your code sample and description what you are trying to do.

Can you copy a few lines of input as a sample, and create a sample (hard-coded) of the desired output. I mean for example you have input:

0 2:-0.5795 3:0.33582025 4:55.8255 5:65.316997 6:15 7:16 8:57 9:28 10: +29 11:23 12:5 13:4328.520884 14:5279.218852 15:7434.371708 16:7829.12 +6536 17:7560.24877 18:7380.518025 19:7094.262906 20:6916.621367 21:61 +98.40255 22:11858.88819484 23:15547.317962699 24:23174.9885578928 25: +26259.9933684153 26:26163.2825969745 27:26115.0415561043 28:25798.425 +8540249 29:24623.253542266 30:23630.8474599248

Desired output would be:

2:-0.5795 3:0.33582025 21:6198.40255 23:15547.317962699

Something like that, of course the sample above it is just an example but at least to give us a direction of what you are trying to do.

Update: Based on your sample of code above your data is ' ' space separated but on your code you split the data with \t. Which one is the correct?

Looking forward to your update, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re^3: Data extraction with specific keywords by thanos1983
in thread Data extraction with specific keywords by neeraj_kr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.