<?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 Perl script for paragraph formatting in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032690#M64553</link>
    <description>i have a perl script which takes file.txt as input.then it searches for .TXT in that and if it finds that it deletes the whole paragraph containing it...(files and codes are attached)&lt;BR /&gt;&lt;BR /&gt;but i want to take a input pattern as per user requirement (say i want to search for word "production" or "on").And want to delete the paragraph containing the word.&lt;BR /&gt;&lt;BR /&gt;Please can you help me to generalise the script like that....</description>
    <pubDate>Thu, 05 Jul 2007 05:19:02 GMT</pubDate>
    <dc:creator>Dodo_5</dc:creator>
    <dc:date>2007-07-05T05:19:02Z</dc:date>
    <item>
      <title>Perl script for paragraph formatting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032690#M64553</link>
      <description>i have a perl script which takes file.txt as input.then it searches for .TXT in that and if it finds that it deletes the whole paragraph containing it...(files and codes are attached)&lt;BR /&gt;&lt;BR /&gt;but i want to take a input pattern as per user requirement (say i want to search for word "production" or "on").And want to delete the paragraph containing the word.&lt;BR /&gt;&lt;BR /&gt;Please can you help me to generalise the script like that....</description>
      <pubDate>Thu, 05 Jul 2007 05:19:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032690#M64553</guid>
      <dc:creator>Dodo_5</dc:creator>
      <dc:date>2007-07-05T05:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script for paragraph formatting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032691#M64554</link>
      <description>&lt;!--!*#--&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;Making the minimum changes yields this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my $pattern = shift or die "pattern expected\n";&lt;BR /&gt;open (LIST,"file.txt") || die "where is file?\n";&lt;BR /&gt;$^I = '';&lt;BR /&gt;$/ = '';&lt;BR /&gt;while (&lt;LIST&gt;) {&lt;BR /&gt;    next if /^.*$pattern.*\n/;&lt;BR /&gt;    print;&lt;BR /&gt;}&lt;BR /&gt;close (LIST);&lt;BR /&gt;&lt;BR /&gt;...By "minimum" changes, please note that 'use strict' will save you countless hours of debugging needlessly.  Using 'use warnings' is far more robust than the older '-w' switch.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/LIST&gt;</description>
      <pubDate>Thu, 05 Jul 2007 12:49:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032691#M64554</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-07-05T12:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script for paragraph formatting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032692#M64555</link>
      <description>The script is very usefull and my purpose has been solved..&lt;BR /&gt;&lt;BR /&gt;another thing i want to know that if i put like that&lt;BR /&gt;&lt;BR /&gt;print "which pattern want to check";&lt;BR /&gt;my $pattern=&lt;STDIN&gt;;&lt;BR /&gt;&lt;BR /&gt;then also it is working...but how to check that if wrong pattern has been given by user then to give output like "Pattern Not found" in the file&lt;BR /&gt;&lt;/STDIN&gt;</description>
      <pubDate>Fri, 06 Jul 2007 01:23:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032692#M64555</guid>
      <dc:creator>Dodo_5</dc:creator>
      <dc:date>2007-07-06T01:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script for paragraph formatting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032693#M64556</link>
      <description>&lt;!--!*#--&gt;Hi (again):&lt;BR /&gt;&lt;BR /&gt;OK, based upon your new requirements, see if this fits your need:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my $file    = 'file.txt';&lt;BR /&gt;my $pattern = '';&lt;BR /&gt;my $matches = 0;&lt;BR /&gt;&lt;BR /&gt;while ( $pattern eq '' ) {&lt;BR /&gt;    print "Enter pattern to check\n";&lt;BR /&gt;    chomp( $pattern = &lt;STDIN&gt; );&lt;BR /&gt;    if ( $pattern =~ m{^\s+$} ) {&lt;BR /&gt;        $pattern = '';&lt;BR /&gt;        next;&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;$^I = '';&lt;BR /&gt;$/  = '';&lt;BR /&gt;open( LIST, "&amp;lt;", $file ) or die "Can't open $file: $!\n";&lt;BR /&gt;while (&lt;LIST&gt;) {&lt;BR /&gt;    $matches++, next if /.*$pattern.*\n/;&lt;BR /&gt;    print;&lt;BR /&gt;}&lt;BR /&gt;warn "\n&amp;gt; Pattern '$pattern' wasn't found in '$file' &amp;lt;\n" if $matches == 0;&lt;BR /&gt;close(LIST);&lt;BR /&gt;&lt;BR /&gt;=snip=&lt;BR /&gt;&lt;BR /&gt;As you requested, the pattern for which to search is read from user input.  Input is solicited by prompting the user until something is provided.  Whitespace (\s)-only lines are rejected.&lt;BR /&gt;&lt;BR /&gt;If *no* matches are found for the pattern provided, the script terminates with a message indicating that.  This warning is written to STDERR giving you the ability to redirect STDERR to /dev/null when you execute the script if you desire.&lt;BR /&gt;&lt;BR /&gt;I've enhanced the open() to explicitly specify an open for input only and to report the file name and the reason for any open failure.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/LIST&gt;&lt;/STDIN&gt;</description>
      <pubDate>Fri, 06 Jul 2007 19:43:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032693#M64556</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-07-06T19:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script for paragraph formatting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032694#M64557</link>
      <description>hi,&lt;BR /&gt;Thanks very much for ur help regarding my problem...the script is very much usefull.&lt;BR /&gt;&lt;BR /&gt;I have also done a script regarding my requirement,but it's a bit lenghthy..&lt;BR /&gt;check it out that in the attachment.</description>
      <pubDate>Mon, 09 Jul 2007 07:37:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-script-for-paragraph-formatting/m-p/4032694#M64557</guid>
      <dc:creator>Dodo_5</dc:creator>
      <dc:date>2007-07-09T07:37:52Z</dc:date>
    </item>
  </channel>
</rss>

