[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

11/05/2009 at 02:38PM PST, ID: 24876382
[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!

9.0

How to extract a single line from a file?

Asked by Trexgreen in Perl Programming Language

Tags: Perl

I have a file that has some information that I need to extract.

The problem is that the information is separated by line, and each line has a code that identify the parameter.

I need to extract all lines that starts with "QU". the problem is that it may be two lines or more.

For some reason I can only get the first line of all "QU". here is my code and a sample of the file.

 

--------------------
SAMPLE FILE THAT I'M READING. I NEED TO GET THE QU SECTION OF THE FILE.
--------------------

QN 00001
QU What are the effects of calcium on the physical properties of mucus
   from CF patients?
NR 00034
RD  139 1222  151 2211  166 0001  311 0001  370 1010  392 0001  439 0001
    440 0011  441 2122  454 0100  461 1121  502 0002  503 1000  505 0001
    520 1010  522 0001  526 1011  527 1001  533 2222  593 1000  619 0001
    737 0100  742 0100  789 0001  827 0010  835 0001  861 0001  875 1121
    891 0001  921 1010  922 1010 1175 0100 1185 0001 1222 0001
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
#!/usr/bin/perl -w
use strict; 
#Reade the file
open FILE, "cfquery" or die $!; 
while (my $string = <FILE>) {
	if ($string =~ /QU/) {
                print $string, "\n";
	}
} 
close FILE;
[+][-]11/05/09 02:54 PM, ID: 25755011

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 03:10 PM, ID: 25755123

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 03:50 PM, ID: 25755418

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 03:51 PM, ID: 25755421

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 03:52 PM, ID: 25755431

View this solution now by starting your 30-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: Perl
Sign Up Now!
Solution Provided By: kaufmed
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20090824-EE-VQP-74 - Hierarchy / EE_QW_3_20080625