<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Need to find and extract words from text file' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Need to find and extract words from text file' posted on the 'Perl' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Mon, 17 Jun 2013 23:58:44 -0700</pubDate>
    <lastBuildDate>Mon, 17 Jun 2013 23:58:44 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Need to find and extract words from text file</title>
      <link>http://www.programmersheaven.com/mb/perl/166597/166597/need-to-find-and-extract-words-from-text-file/</link>
      <description>Hello,&lt;br /&gt;
&lt;br /&gt;
I know this is done with regular expressions, but I don't know how.  I have text file that contains many lines of information.  How would I find the line that contains the word "subject:".  Then once that line is found how would i get only the text after the colon in to a variable?  For example, let say the line is in row 56 and it looks like this: "subject: ORDER CONFIRMATION".  How would I find the subject, and how do I get the "ORDER CONFIRMATION".  I need to find the subject and only get the subject.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/perl/166597/166597/need-to-find-and-extract-words-from-text-file/</guid>
      <pubDate>Tue, 21 Jan 2003 16:38:48 -0700</pubDate>
      <category>Perl</category>
    </item>
    <item>
      <title>Re: Need to find and extract words from text file</title>
      <link>http://www.programmersheaven.com/mb/perl/166597/166792/re-need-to-find-and-extract-words-from-text-file/#166792</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
: I know this is done with regular expressions, but I don't know how.  I have text file that contains many lines of information.  How would I find the line that contains the word "subject:".  Then once that line is found how would i get only the text after the colon in to a variable?  For example, let say the line is in row 56 and it looks like this: "subject: ORDER CONFIRMATION".  How would I find the subject, and how do I get the "ORDER CONFIRMATION".  I need to find the subject and only get the subject.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OK, I'm still trying to get better at reg exp myself, but I think I may have the answer to this one.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
open FILE, "&amp;lt;textfile.txt";
while (&amp;lt;FILE&amp;gt;) {
     if (/subject\: (.*)/) {
          $whatyouwant = $1;
     }
}
close FILE;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Let me know if that works, I gotta run deal with something so can't test it right now.&lt;br /&gt;
&lt;br /&gt;
Hope this helps,&lt;br /&gt;
&lt;br /&gt;
Jonathan&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------&lt;br /&gt;
Count your downloads:&lt;br /&gt;
&lt;a href="http://www.downloadcounter.com/"&gt;http://www.downloadcounter.com/&lt;/a&gt;&lt;br /&gt;
And host your site:&lt;br /&gt;
&lt;a href="http://www.incrahost.com/"&gt;http://www.incrahost.com/&lt;/a&gt;&lt;br /&gt;
Don't say I never give you anything... &lt;img src="http://www.programmersheaven.com/images/Community/twink.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/perl/166597/166792/re-need-to-find-and-extract-words-from-text-file/#166792</guid>
      <pubDate>Wed, 22 Jan 2003 14:10:57 -0700</pubDate>
      <category>Perl</category>
    </item>
    <item>
      <title>Re: Need to find and extract words from text file</title>
      <link>http://www.programmersheaven.com/mb/perl/166597/174013/re-need-to-find-and-extract-words-from-text-file/#174013</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
You can use perl system variable $' to extract particular text from the file.&lt;br /&gt;
&lt;br /&gt;
Bharat&lt;br /&gt;
indiabhushan@yahoo.com&lt;br /&gt;
&lt;br /&gt;
: Hello,&lt;br /&gt;
: &lt;br /&gt;
: I know this is done with regular expressions, but I don't know how.  I have text file that contains many lines of information.  How would I find the line that contains the word "subject:".  Then once that line is found how would i get only the text after the colon in to a variable?  For example, let say the line is in row 56 and it looks like this: "subject: ORDER CONFIRMATION".  How would I find the subject, and how do I get the "ORDER CONFIRMATION".  I need to find the subject and only get the subject.&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/perl/166597/174013/re-need-to-find-and-extract-words-from-text-file/#174013</guid>
      <pubDate>Mon, 03 Mar 2003 02:57:06 -0700</pubDate>
      <category>Perl</category>
    </item>
    <item>
      <title>Re: Need to find and extract words from text file</title>
      <link>http://www.programmersheaven.com/mb/perl/166597/427846/re-need-to-find-and-extract-words-from-text-file/#427846</link>
      <description>I have something smiliar question in perl.&lt;br /&gt;
I have a text file, and I would like to search a "1234", but would like to display the keyword from the text file of the number.&lt;br /&gt;
&lt;br /&gt;
file1&lt;br /&gt;
------------&lt;br /&gt;
Number: 1234&lt;br /&gt;
Keyword:&lt;br /&gt;
Will do the same&lt;br /&gt;
Comment: No need to take action&lt;br /&gt;
&lt;br /&gt;
Number: 2345&lt;br /&gt;
Keyword:&lt;br /&gt;
Hello World&lt;br /&gt;
Comment: Just say Hi&lt;br /&gt;
&lt;br /&gt;
so on.....&lt;br /&gt;
---------&lt;br /&gt;
&lt;br /&gt;
I know the Number: 1234, so I can use "grep to search the number"&lt;br /&gt;
But I would like to display the Keyword corresponding to the Keyword.&lt;br /&gt;
&lt;br /&gt;
-------&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
Number: 1234&lt;br /&gt;
Keyword: &lt;br /&gt;
Will do the same&lt;br /&gt;
&lt;br /&gt;
Number: 2345&lt;br /&gt;
Keyword:&lt;br /&gt;
Hello World&lt;br /&gt;
&lt;br /&gt;
---------&lt;br /&gt;
&lt;br /&gt;
Anyone know how to do so? Please help...&lt;br /&gt;
Thanks!&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/perl/166597/427846/re-need-to-find-and-extract-words-from-text-file/#427846</guid>
      <pubDate>Tue, 13 Mar 2012 16:18:32 -0700</pubDate>
      <category>Perl</category>
    </item>
  </channel>
</rss>