<?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: How to print certain pages from a disk file in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-to-print-certain-pages-from-a-disk-file/m-p/4918840#M104196</link>
    <description>You can try using software called a2ps.&lt;BR /&gt;&lt;BR /&gt;$ a2ps --interpret=yes --pages=1-3 --output test.ps test.txt&lt;BR /&gt;&lt;BR /&gt;--interpret=yes makes it interpret form feed character (^L) as page break&lt;BR /&gt;--pages to select what pages to print&lt;BR /&gt;--output for testing then examine test.ps to make sure it's what you expect&lt;BR /&gt;&lt;BR /&gt;You can download a2ps from&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.connect.org.uk" target="_blank"&gt;http://hpux.connect.org.uk&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;or the closest mirror</description>
    <pubDate>Tue, 16 Aug 2005 21:00:21 GMT</pubDate>
    <dc:creator>Ermin Borovac</dc:creator>
    <dc:date>2005-08-16T21:00:21Z</dc:date>
    <item>
      <title>How to print certain pages from a disk file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-print-certain-pages-from-a-disk-file/m-p/4918839#M104195</link>
      <description>Hi all&lt;BR /&gt;&lt;BR /&gt;I want to print a range of pages from a disk file (a lengthly report).  As I need to pass 3 arguments to this script, so the syntax will be "prnpage.sh filename from_page to_page".  The pages are not fixed length because of control breaks. (eg. print by sales rep by state etc).  On the report, there is a control code "^L" to denote new page.&lt;BR /&gt;&lt;BR /&gt;I managed to print a range of pages successfully if number of detail lines on pages are the same.&lt;BR /&gt;&lt;BR /&gt;Also, how can I grep the "^L"?&lt;BR /&gt;&lt;BR /&gt;Any idea to tackle this problem is appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Davis</description>
      <pubDate>Tue, 16 Aug 2005 18:29:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-print-certain-pages-from-a-disk-file/m-p/4918839#M104195</guid>
      <dc:creator>Hoey</dc:creator>
      <dc:date>2005-08-16T18:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to print certain pages from a disk file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-print-certain-pages-from-a-disk-file/m-p/4918840#M104196</link>
      <description>You can try using software called a2ps.&lt;BR /&gt;&lt;BR /&gt;$ a2ps --interpret=yes --pages=1-3 --output test.ps test.txt&lt;BR /&gt;&lt;BR /&gt;--interpret=yes makes it interpret form feed character (^L) as page break&lt;BR /&gt;--pages to select what pages to print&lt;BR /&gt;--output for testing then examine test.ps to make sure it's what you expect&lt;BR /&gt;&lt;BR /&gt;You can download a2ps from&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.connect.org.uk" target="_blank"&gt;http://hpux.connect.org.uk&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;or the closest mirror</description>
      <pubDate>Tue, 16 Aug 2005 21:00:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-print-certain-pages-from-a-disk-file/m-p/4918840#M104196</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2005-08-16T21:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to print certain pages from a disk file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-print-certain-pages-from-a-disk-file/m-p/4918841#M104197</link>
      <description>To get the ^L search pattern type Quote CTRL-V CTRL-L Quote. i.e. hold down the CTRL key and press V then L without letting go of the control key.&lt;BR /&gt;&lt;BR /&gt;A basic script could be something like ...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FILE=$1&lt;BR /&gt;FP=$2&lt;BR /&gt;LP=$3&lt;BR /&gt;&lt;BR /&gt;if [ "$FP" -eq 1 ]&lt;BR /&gt;then&lt;BR /&gt;    FL=0&lt;BR /&gt;else&lt;BR /&gt;    FP=`expr $FP - 1`&lt;BR /&gt;    FL=`grep -n "^L" $1 | cut -f1 -d":" | head -$FP | tail -1`&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;TP=`grep -n "^L" $1 | wc -l`&lt;BR /&gt;&lt;BR /&gt;if [ "$LP" -gt "$TP" ]&lt;BR /&gt;then&lt;BR /&gt;    LL=`wc -l $1 | awk '{ print $1 }'`&lt;BR /&gt;else&lt;BR /&gt;    LL=`grep -n "^L" $1 | cut -f1 -d":" | head -$LP | tail -1`&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;TL=`expr $LL - $FL`&lt;BR /&gt;&lt;BR /&gt;head -$LL $1 | tail -$TL&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Where TP=total pages, TL=total lines, FP=first page, FL=first line, LP=last page, LL=last line. You might have to change it depending on whether the last page in the file has a ^L at the end of it or not. Also what do you want to do if they request page 6 of a 5 page document? The script above would print the last page in the document in response.</description>
      <pubDate>Wed, 17 Aug 2005 03:50:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-print-certain-pages-from-a-disk-file/m-p/4918841#M104197</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2005-08-17T03:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to print certain pages from a disk file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-print-certain-pages-from-a-disk-file/m-p/4918842#M104198</link>
      <description>Thanks to Ermin &amp;amp; Stephen.  My scripts are working perfectly now.</description>
      <pubDate>Thu, 18 Aug 2005 17:52:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-print-certain-pages-from-a-disk-file/m-p/4918842#M104198</guid>
      <dc:creator>Hoey</dc:creator>
      <dc:date>2005-08-18T17:52:36Z</dc:date>
    </item>
  </channel>
</rss>

