Printing Ascii files via lpr

Ask a Question related to Linux / Unix Administration, Design and Development.

  1. #1

    Default Printing Ascii files via lpr

    Is there a utility that takes an ascii text file. prints all
    of the odd pages on one side of paper, in this case via a dot matrix
    printer. and I flip the paper over to print the other sides? I don't
    want to use a2ps. as ghostscript is slow on my IBM proprinter XE. Thus
    I want to print it in the native fonts of the printer. There is some
    utilities for MSDOS for this, Anything for Unix or Linux?

    --
    A tagline from Comp.os.Linux.Advocacy:
    (I keep hearing RTFM, but I'm not sure where TFM is).
    From the Desk of the Sysop of:
    Planet Maca's Opus, a Free open BBS system.
    Telephone 860-738-7176 300-33.6kbps
    [url]Telnet://pinkrose.rivernet.cc[/url]. Open 24/7!
    The New Cnews maintainer
    B'ichela

    B'ichela Guest

  2. Similar Questions and Discussions

    1. Printing PDF files
      Is there any tag or custom tag that will cause a pdf file to print????
    2. ID CS not printing placed .eps files
      Greetings all; ID CS, Windows 2000 I have converted a Quirk 4 document into ID CS and have reworked the document besides. The page is quite...
    3. Printing to .ps files
      Suddenly, nobody in our office can print to a .ps file from ID 2. After 90 minutes of panicked troubleshooting, I found that if I attempt to print...
    4. Printing ASCII to Hex
      Hi, There must be an easier way to convert a basic ascii string to hex. I tried using ord/chr/unpack/sprintf(%x) combinations and just dug my...
    5. To count a number of lines in C++ or Java or ASCII files by exluding white spaces and comments
      Hi all, We have huge files in Java and C++ and I need to count the total number of lines in each of them by excluding white spaces (from the...
  3. #2

    Default Re: Printing Ascii files via lpr

    Someone who looks an awful lot like B'ichela <mdalene@pinkrose.net.dhis.org> wrote:
    > Is there a utility that takes an ascii text file. prints all
    > of the odd pages on one side of paper, in this case via a dot matrix
    > printer. and I flip the paper over to print the other sides? I don't
    > want to use a2ps. as ghostscript is slow on my IBM proprinter XE. Thus
    > I want to print it in the native fonts of the printer. There is some
    > utilities for MSDOS for this, Anything for Unix or Linux?
    Yup, I think what you want is "pr". Lets you do portrait, landscape,
    specify columnts, font size, headers, line numbering, and I would
    suspect pagination as you mention.

    A quick check of my systems shows it's there on a Linux box, a
    FreeBSD box, a Solaris 8 (Solaris 2.8, SunOS 5.8, whatever you want
    to call it) box, and, er, that's all I checked. But, looks like you
    can find it on SysV and/or BSD-ish systems. Makes nice looking output,
    should do what you're after.

    Hope this helps,
    Dave Hinz


    davehinz@spamcop.net Guest

  4. #3

    Default Re: Printing Ascii files via lpr

    B'ichela wrote:
    > Is there a utility that takes an ascii text file. prints all
    > of the odd pages on one side of paper, in this case via a dot matrix
    > printer. and I flip the paper over to print the other sides? I don't
    > want to use a2ps. as ghostscript is slow on my IBM proprinter XE. Thus
    > I want to print it in the native fonts of the printer. There is some
    > utilities for MSDOS for this, Anything for Unix or Linux?
    >
    Not that I'm aware of but you can roll one pretty easily using csplit
    or pr | csplit. Use csplit to burst the output into one page per file
    then cat the pages to the printer in the desired order.

    -- ced

    --
    Chuck Dillon
    Senior Software Engineer
    NimbleGen Systems Inc.

    Chuck Dillon Guest

  5. #4

    Default Re: Printing Ascii files via lpr

    <html><input type crash></html>
    begin B'ichela wrote:
    > In article <beg1ec$4o5r6$1@ID-134476.news.dfncis.de>, [email]davehinz@spamcop.net[/email] wrote:
    >> Yup, I think what you want is "pr". Lets you do portrait, landscape,
    >> specify columnts, font size, headers, line numbering, and I would
    >> suspect pagination as you mention.
    > I use pr quite often, and to my knowledge, there is no way to
    > easily use it to print all of the odd pages, flip the paper around to
    > print all of the evens.
    > Looking at the gnu pr (thats the one with Slackware 8.0 linux
    > here) the option:
    > +FIRST_PAGE[:LAST_PAGE],
    > --pages=FIRST_PAGE[:LAST_PAGE]
    >
    > begin [stop] printing with page FIRST_[LAST_]PAGE
    > Looks like I would have to do something like this
    > pr +1:1 myfile | lpr
    > second page:
    > pr +p3:3 myfile| lpr
    > could I use a .sh script via a counting to count from 1-480 in odd
    > numbers and feed that to pr? like this
    > pr +$page:$page myfile | lpr
    >
    >
    Since I know you have Linux I suggest:

    for pg in $(seq 1 2 480)
    do
    pr +${pg}:${pg} myfile >>/tmp/odds
    done
    lpr /tmp/odds

    Reload paper...

    for pg in $(seq 2 2 480)
    do
    pr +${pg}:${pg} myfile >>/tmp/evens
    done
    lpr /tmp/evens

    Does not seem that hard and would be more efficient than
    spooling all those pages individually.

    Sending 'pr' across your file 480 times might take longer than
    the ghostscript method though.

    --
    "As long as they are going to steal it, we want them to steal ours. They'll get
    sort of addicted, and then we'll somehow figure out how to collect sometime in
    the next decade." -- Bill Gates, explaining how Microsoft views software piracy
    <http://news.com.com/2100-1023-212942.html?legacy=cnet>
    Edgar Allen Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139