<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: yet another quick perl question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499129#M705035</link>
    <description>Drat! I cannot type *that* fast!</description>
    <pubDate>Mon, 07 Mar 2005 09:44:46 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2005-03-07T09:44:46Z</dc:date>
    <item>
      <title>yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499125#M705031</link>
      <description>Got a perl script:&lt;BR /&gt;&lt;BR /&gt;my $refer = "\"certified.shmtl\"";&lt;BR /&gt;print "Before: ",$refer,"\n";&lt;BR /&gt;# $refer =~ tr ?/??d;&lt;BR /&gt;print "After : ",$refer,"\n";&lt;BR /&gt;&lt;BR /&gt;The first print statement prints&lt;BR /&gt;&lt;BR /&gt;"certified.shtml"&lt;BR /&gt;&lt;BR /&gt;I need to strip the trailing and leading double quotes out of the string. Can't seem to make line 3 (commented) do that for me.&lt;BR /&gt;&lt;BR /&gt;Thanks to A. Clay Stephenson forthe base code.&lt;BR /&gt;&lt;BR /&gt;Background: while moving a html document from one location to another, I'm pulling alont the VIRTUAL include document embedded in the document as well.&lt;BR /&gt;&lt;BR /&gt;The line starts out looking like:&lt;BR /&gt;&lt;!--#INCLUDE VIRTUAL="certified.shtml" --&gt;&lt;BR /&gt;&lt;BR /&gt;I used awk to cook it down to "certified.shtml"&lt;BR /&gt;&lt;BR /&gt;Good Solution: 1 line of perl that strips out the trailing and leading double quotes.&lt;BR /&gt;&lt;BR /&gt;Pefect solution: Perl code that goes straight through the html docu and gives me certified.shtml&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Mar 2005 09:34:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499125#M705031</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-03-07T09:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499126#M705032</link>
      <description>$refer =~ s/\"//g;&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Mar 2005 09:41:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499126#M705032</guid>
      <dc:creator>Ken Penland_1</dc:creator>
      <dc:date>2005-03-07T09:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499127#M705033</link>
      <description>my $refer = qq{"certified.shmtl"}; # /me woders if that should have been shtml&lt;BR /&gt;&lt;BR /&gt;print "Before: $refer\n"; # Wy list, just interpolate!&lt;BR /&gt;$refer =~ tr/"//d; # or $refer =~ s/"//g;&lt;BR /&gt;print "After: $refer\n";&lt;BR /&gt;&lt;BR /&gt;Safe and generic:&lt;BR /&gt;&lt;BR /&gt;$refer =~ s/^\s*"?(.*)"?\s*$//;&lt;BR /&gt;&lt;BR /&gt;And your one-liner:&lt;BR /&gt;&lt;BR /&gt;# perl -nle'm{include\s+virtual="([^"]+)"} and print $1' blah.html&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 07 Mar 2005 09:44:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499127#M705033</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-03-07T09:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499128#M705034</link>
      <description>Thats a bunny.&lt;BR /&gt;&lt;BR /&gt;I'll leave the thread open a few hours in case someone wants to do the Perfect solution.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 07 Mar 2005 09:44:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499128#M705034</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-03-07T09:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499129#M705035</link>
      <description>Drat! I cannot type *that* fast!</description>
      <pubDate>Mon, 07 Mar 2005 09:44:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499129#M705035</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-03-07T09:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499130#M705039</link>
      <description>Note:&lt;BR /&gt;&lt;BR /&gt;The perl script was already running, so a one liner was not actually needed.&lt;BR /&gt;&lt;BR /&gt;What was asked in the perfect answer was a few lines of code to search the a different file say named column.shtml for that &lt;BR /&gt;&lt;BR /&gt;&lt;!--#INCLUDE VIRTUAL="certified.shtml" --&gt;&lt;BR /&gt;&lt;BR /&gt;and get the filename certified.shtml into a variable.&lt;BR /&gt;&lt;BR /&gt;Thread still open, a chance for Merijn to double his pointage.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 07 Mar 2005 09:52:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499130#M705039</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-03-07T09:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499131#M705042</link>
      <description># perl -nle'm{include\s+virtual="([^"]+)"}i and print $1' column.shtml&lt;BR /&gt;&lt;BR /&gt;or inside the script&lt;BR /&gt;&lt;BR /&gt;:&lt;BR /&gt;:&lt;BR /&gt;m{include\s+virtual="([^"]+)"}i and print $file = $1;&lt;BR /&gt;:&lt;BR /&gt;:&lt;BR /&gt;&lt;BR /&gt;$file now contains "certified.shtml"&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 07 Mar 2005 09:58:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499131#M705042</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-03-07T09:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499132#M705043</link>
      <description>If that syntax is stable, then you can exploit the double-quote to split the line on:&lt;BR /&gt;&lt;BR /&gt;Some variation of:&lt;BR /&gt;&lt;BR /&gt;perl -ne 'if (/INCLUDE VIRT/) { $file=(split(/"/))[1];  print "file=$file\n "}' input-data.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Mar 2005 10:27:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499132#M705043</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-03-07T10:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499133#M705044</link>
      <description>Having a testing issue.&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# $refer =~ s/\"//g;&lt;BR /&gt;$refer  = "stevefile";&lt;BR /&gt;&lt;BR /&gt;m{include\s+virtual="([^"]+)"}i and print $file = $refer; &lt;BR /&gt;&lt;BR /&gt;print "After : ",$file,"\n";&lt;BR /&gt;&lt;BR /&gt;Does not produce output.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/opt/perl/bin/perl -nle'm{include\s+virtual="([^"]+)"}i and print $1' stevefile&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;hpuxws.shtml&lt;BR /&gt;&lt;BR /&gt;searches the file and produces appropriate output.&lt;BR /&gt;&lt;BR /&gt;Kind of wonderinig what I'm doing wrong. I like Merijn's approach and would like to finish the job. I have tried submiting the file stevefile on the command line but that produces nothing new and does not accomplish objective.&lt;BR /&gt;&lt;BR /&gt;The file name inbedded in the file stevefile is the output I want, double quotes stripped.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;~&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Mar 2005 15:58:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499133#M705044</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-03-07T15:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499134#M705045</link>
      <description>In this snippet:&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;&lt;BR /&gt;# $refer =~ s/\"//g;&lt;BR /&gt;$refer = "stevefile";&lt;BR /&gt;&lt;BR /&gt;m{include\s+virtual="([^"]+)"}i and print $file = $refer; &lt;BR /&gt;&lt;BR /&gt;print "After : ",$file,"\n";&lt;BR /&gt;--&amp;gt;8---&lt;BR /&gt;I do not see a loop that puts every line of the file being parsed in $_, something that the -n option in&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;/opt/perl/bin/perl -nle'm{include\s+virtual="([^"]+)"}i and print $1' stevefile&lt;BR /&gt;--&amp;gt;8---&lt;BR /&gt;&lt;BR /&gt;does. In your script, you match against $_, which is empty. So if you want the *script* to do the same as the oneliner, change it to something like&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;&lt;BR /&gt;my $file = "?";&lt;BR /&gt;@ARGV = ("stevefile");&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;m{include\s+virtual="([^"]+)"}i and $file = $1; &lt;BR /&gt;}&lt;BR /&gt;print "After : ",$file,"\n";&lt;BR /&gt;--&amp;gt;8---&lt;BR /&gt;&lt;BR /&gt;and see if that fits your needs&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Wed, 09 Mar 2005 16:31:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499134#M705045</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-03-09T16:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: yet another quick perl question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499135#M705046</link>
      <description>Thanks Merijn,&lt;BR /&gt;&lt;BR /&gt;Funny you posted it right after I finished coding it to work with an external shell script.&lt;BR /&gt;&lt;BR /&gt;I will however play with this, because I didn't like the idea of going to the external shell script in the first place.&lt;BR /&gt;&lt;BR /&gt;Top notch. Bunny in transit.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 09 Mar 2005 16:34:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/yet-another-quick-perl-question/m-p/3499135#M705046</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-03-09T16:34:12Z</dc:date>
    </item>
  </channel>
</rss>

