With respect to "pr"

zben at umd5.UUCP zben at umd5.UUCP
Wed Jun 19 09:00:12 AEST 1985


There was a description of the Amiga posted to one of the micro groups, but
it was posted in 40 column format.  Remembering something I got to work with
the Software Tools on the Univac, I read my manual, then tried the following
command to put the article ("source") into 80 column format:

% pr -m -2 - - <source
can't print 0 cols, using 1 instead.
can't print 0 cols, using 1 instead.
pr: Too many args

Analysis: -m -2 says merge to two columns, but making both arguments dash was
supposed to bind both inputs to stdin, so pr would actually read alternate
lines from the same file, i.e., the pipe from "source".  Actually, pr does not
seem to believe in the - for stdin convention, and is parsing the arguments
as "-0" for zero column, i.e., passing a null string to atoi() and getting
zero back...

Now, I realize that it's a trivial thing to do with "awk":

awk '
NR%2!=0 { s = substr($0,1,40) }
NR%2==0 { printf "%s %s\n",s,substr($0,1,40)  }
'

and that's eventually how I did it.  Talking this over with my local guru,
he started getting nasty, and said that even if I added the "-" for stdin
code to pr he wouldn't install it on the system.  Something about trying
to keep unix the same on all the machines, and he couldn't convince all the
other gurus to do it to their unixes too.  The same kind of arguments that
got us called high priests in the first place...

I would appreciate a few words (in MAIL please) from gurus of long standing,
like over 10 years in, on why my suggestion is so bogus.
-- 
Ben Cranston  ...{seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben  zben at umd2.ARPA



More information about the Comp.unix.wizards mailing list