Advertisement

10.11.2005 at 06:39PM PDT, ID: 21591828
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

parse text file to print specific tagged text

Asked by GessWurker in Perl Programming Language

Tags: , ,

I have some code that prints the first three lines of a text file. However, I'd like to modify it so that it prints only the text (up to the end of the line) that comes after the following "tags"
SDI_TOPIC
and
SDI_DATE

At bottom is my current code, which returns the following (the first three lines of the file)

SDI_TOPIC Amlodipine
Record_ID 727994ADF56CAEBB8525708F006892BF
SDI_DATE 10/03/2005

How would I modify the code so that all it printed was the text following SDI_TOPIC and the text following SDI_DATE. I want to search for those tags and print the content following.

Ideally, I'd end up with two variables
$SDI_TOPIC and $SDI_DATE that hold my content.

My current code:
$file="c:\\temp\\newtest.txt";

open INF, $file or die $!;

@lines = (<INF>);
close INF;
    {
        local $/; # engage slurp mode
        open my $fh, $file or die "Error opening $file: $!";
        @lines = split /\r\n|\n\r|\n|\r/, <$fh>;
    }

    local $, = "\n========\n";
    print @lines[0]."\n";
    print @lines[1]."\n";
    print @lines[2]."\n";
Start Free Trial
 
Keywords: parse text file to print specific tagged t…
 
Loading Advertisement...
 
[+][-]10.11.2005 at 08:22PM PDT, ID: 15065946

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.11.2005 at 11:29PM PDT, ID: 15066580

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 04:09AM PDT, ID: 15067640

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 04:24AM PDT, ID: 15067711

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 04:43AM PDT, ID: 15067810

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 07:58AM PDT, ID: 15069490

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 08:38AM PDT, ID: 15069936

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 08:49AM PDT, ID: 15070052

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 09:05AM PDT, ID: 15070192

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 11:25AM PDT, ID: 15071414

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: file, parse, text
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 3
Solution Grade: A
 
 
[+][-]10.12.2005 at 11:52AM PDT, ID: 15071670

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.13.2005 at 07:40PM PDT, ID: 15082712

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.13.2005 at 07:44PM PDT, ID: 15082725

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.13.2005 at 07:55PM PDT, ID: 15082746

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32