INFO-UNIX Digest V11#097
The Moderator
lgdelta!email!tachost!BRL.MIL!Info-Unix-Request at tachost.af.mil
Wed Jan 23 14:03:14 AEST 1991
INFO-UNIX Digest Sat, 19 Jan 1991 V11#097
Today's Topics:
Re: portability of non-shell scripts
kermit servers
Re: how to create a user, which can't be su'd to ?
Nroff -man and two-/one-sided output
need "yy-ddd-hh:mm:ss ==> (time_t) clock" converter
Re: need "yy-ddd-hh:mm:ss ==> (time_t) clock" converter
reading in ascii files on a tape using tar?
Ksh questions
Tek 4319 threads?
Why is there no NFS with XENIX
GDSII<->PostScript<->HPGL translation pgms wanted
Can UNIX pipe connections be compiled?
Re: Can UNIX pipe connections be compiled?
Re: shell in programs
Re: exist enscript for sun4?
Re: SUMMARY: A Good Network Programming Book.
Re: Setting my prompt
-----------------------------------------------------------------
From: "David H. Brierley" <dave at galaxia.newport.ri.us>
Subject: Re: portability of non-shell scripts
Keywords: portability
Date: 18 Jan 91 02:32:27 GMT
To: info-unix at sem.brl.mil
In article <1991Jan15.233523.18150 at ux1.cso.uiuc.edu> phil at ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes:
[ talks about problems when using #! construct ]
...
>... Has anyone worked a general way to make
>these script programs more portable so that they will run w/o having to
>have the user do editing on them?
How do you plan on having this work "portably" on systems that don't
support the #! mechanism? The only thing I know of that is even close
to being portable is to assume that your script will be run by one of
the shell interpreters and have the first line of the file exec the
program that you really want run. Make sure that you dont have anything
on this first line that is sh/ksh/csh specific because I can't gaurantee
what shell will be used to run your script.
This is one of those problems that has no real solution short of forcing
everyone to upgrade to a version of the kernel that supports the #!
mechanism (yes, the #! mechanism is implemented *inside the kernel*!!).
Since you can make a pretty good guess as to what the odds of this happening
are you can apply those same odds to coming up with a solution.
--
David H. Brierley
Home: dave at galaxia.Newport.RI.US Work: dhb at quahog.ssd.ray.com
Can I be excused, my brain is full.
-----------------------------
From: Mathias Koerber <koerberm at nixsin.uucp>
Subject: kermit servers
Keywords: kermit server kill
Date: 18 Jan 91 10:07:25 GMT
To: info-unix at sem.brl.mil
Greetings
I'm having a question about Kermit, on PC as well as on UNIX. I want to
make my unix system run a kermit server to accept file-transfers initiated
by the PC on dial-up lines, but I also want the unix-system to be able to
initiate a transfer. For this, I need either to shut down the server on the
unix side and start one on the PC like in the following chart:
UNIX PC
======================================
kermit server start
kermit dial..
kermit send file-upload
finish
(server dies)
kermit server start
kermit send file-download
finish
(server dies)
kermit server start
and so on.
Or (better), I'd like two kermit servers, which also accept commands from the
outside. They listen on the line for incoming requests, but also monitor a
command-interface for locally initiated requests. On unix, this could
be done using a signal, and then looking at a file, but on MessyDos?
Has anybody done something like this already and can give me some info/help?
Thx alot
Mathias
--
Mathias Koerber | S iemens | EUnet: koerber.sin at nixdorf.de
2 Kallang Sector | N ixdorf | USA: koerber.sin at nixdorf.com
S'pore 1344 | I nformation Systems | Tel: +65/7402852 | Fax: +65/7402834
* Packed with Power, SNIckers really satisfy (or do they? Ask them gals :-) )*
-----------------------------
From: Kartik Subbarao <subbarao at phoenix.princeton.edu>
Subject: Re: how to create a user, which can't be su'd to ?
Keywords: su
Date: 18 Jan 91 16:23:40 GMT
Sender: news at idunno.princeton.edu
To: info-unix at sem.brl.mil
In article <1460 at nixsin.UUCP> koerberm at nixsin.UUCP (Mathias Koerber) writes:
>Howdy,
>
>I have a (small) system, which I want all my staff to be able to shutdown in
>the evening, without having to give them full root access. So i created a user
>"shut", whose .profile calls /etc/shutdown with all the necessary parameters.
>
>I want to protect this account against being accessed via su, so that it is not
>used accidentally. How can I do this?
To avoid all hassles of making a new user with user id 0, you can simply
write a small C program (as opposed to a problematic shell script) that
execl's /etc/shutdown with the desired parameters, and make that program
set UID root.
i.e:
main()
{
execl ("/etc/shutdown", "shutdown", "Your arguments here", (char *) 0);
}
and everything is okay.
-Kartik
--
internet# find . -name core -exec cat {} \; |& tee /dev/tty*
subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet
kartik at silvertone.Princeton.EDU (NeXT mail) -|
SUBBARAO at PUCC.BITNET - Bitnet
-----------------------------
From: lim at ecs.umass.edu
Subject: Nroff -man and two-/one-sided output
Date: 18 Jan 91 16:42:50 GMT
To: info-unix at sem.brl.mil
Nroff with the -man option outputs for two-sided printing (prints on both sides
of a sheet). As a result, the page numbers are either on the odd or even side
depending on what page it is. Does anyone know how to change it so that the
output is for one-sided printing, while still using the -man option? Thanks.
Jonathan Lim
-----------------------------
From: Tim Singletary <tsingle at sunland.gsfc.nasa.gov>
Subject: need "yy-ddd-hh:mm:ss ==> (time_t) clock" converter
Date: 18 Jan 91 17:08:47 GMT
Sender: news at dftsrv.gsfc.nasa.gov
To: info-unix at sem.brl.mil
Help! I need something to convert yy-ddd-hh:mm:ss (i.e. year,
day_of_year, hour, minute, second) to a unix-style
_number_of_seconds_since_00:00:00_GMT,_Jan._1,_1970_.
I tried to use Sun's timelocal() function but couldn't get it to work (it
lets you pass both _day_of_year_ and _month,_day_of_month_ with no way
to specify which is correct!).
Ideally what I'm looking for is source code to a timelocal() function,
but any tips or suggestions will be appreciated.
Thanks in advance,
tim
--
Tim Singletary, August Automation Inc., (301) 286-7942
--
NRA extremist, etc.
-----------------------------
From: Joe Porkka <jap at convex.cl.msu.edu>
Subject: Re: need "yy-ddd-hh:mm:ss ==> (time_t) clock" converter
Date: 18 Jan 91 20:07:00 GMT
Sender: news at msuinfo.cl.msu.edu
To: info-unix at sem.brl.mil
tsingle at sunland.gsfc.nasa.gov (Tim Singletary) writes:
>Help! I need something to convert yy-ddd-hh:mm:ss (i.e. year,
>day_of_year, hour, minute, second) to a unix-style
>_number_of_seconds_since_00:00:00_GMT,_Jan._1,_1970_.
>I tried to use Sun's timelocal() function but couldn't get it to work (it
Since your using a Sun you can use strptime(), at least
in SunOS 4.1.
I have no idea if this is a Sun defined function, or an ANSI
function.
-----------------------------
From: Carlos 666 Trott <fuentes at romulus.rutgers.edu>
Subject: reading in ascii files on a tape using tar?
Date: 18 Jan 91 17:09:29 GMT
To: info-unix at sem.brl.mil
I just got my own unix boxes and am new to the unix world...so
forgive the stupid question...
I will be getting several dozen labelled and unlabelled ascii
tapes (some created on vaxen, others on big blue). What command
whould I use to copy these files from tape to disk.
-Carlos
Citicorp*Lynch, Jones & Ryan
-----------------------------
From: Stephen Harris <sweh at tharr.uucp>
Subject: Ksh questions
Date: 18 Jan 91 17:28:55 GMT
Followup-To: comp.unix.questions
To: info-unix at sem.brl.mil
Hi all,
Having just upgraded to Ultrix 4.1 I noticed we have the Korn Shell
on the system. Since this shell is being used as the root shell in our
American and Greek offices I thought I should learn about this, and what
better way than to force it to be my login shell?
I altered my .login file and made it .profile, and altered my .cshrc and
made it my .envfile (adding ENV=$HOME/.envfile to my .profile) but have
come across a few problems:
1) To stop me reading the motd file everytime I login I have a .hushlogin,
but since an alteration may be important I had these lines in my .login:
find /etc/motd -newer .hushlogin -exec cat /etc/motd {} \;
touch .hushlogin
However, under ksh I get
find: Incomplete statement
I have tried quoting the braces but to no affect. Any ideas?
2) Aliases
I had a few aliases looking like
alias ut tail \!* /usr/spool/uucp/LOGFILE
How can I have parameters like this in KSH aliases without falling back on the
obvious function:
ut()
{
tail $* /usr/spool/uucp/LOGFILE
}
3) Testing for the existence of a variable.
Since I normally run under 'screen' I have the following lines in my .login
file:
set prompt="vax% "
if ( $?WINDOW != 0 ) then
set prompt="($WINDOW)% "
endif
if ($?ush != 0) then
set prompt="(ush)% "
endif
Is there a ksh equivalent to the $?variable csh structure? I find using
PS1=${WINDOW:-vax}
if [ $PS1 = vax ]
then
export PS1="vax% "
else
export PS1="($PS1)% "
fi
messy!
4) goto....don't moan!
In my .login file (at the end) I have the following:
onintr no_screen
stty -echo intr ' '
/bin/echo "Starting screen...."
sleep 3
stty echo intr ^C
screen
onintr
goto end_screen
no_screen:
stty echo intr ^C
/bin/echo ""
/bin/echo "Aborted...."
onintr
end_screen:
How would I do the equivalent in ksh?
5) Command editing
In csh if I type 'ls -l filename', then I can access !:0 !:1 and !:2 and !*
enabling a command such as 'more !:2'
What is the equivalent ksh command?
There you go, some nice questions for all you KSH experts to answer :-)
(PS: Ultrix 4.1 comes with KSH version 11/16/88 and I have access to 11/16/88b)
Thanks a lot,
--
Stephen Harris
Disclaimer: me have an opinion? | Email: ..!ukc!axion!tharr!sweh
What an idea! | sweh%tharr.uucp at uk.co.bt.axion
Wanted: humour transplant | tharr!sweh at uk.ac.ukc
<-- tharr *free* public access to Usenet in the UK 0234 261804 -->
-----------------------------
From: Eric Berggren <berggren at eecs.cs.pdx.edu>
Subject: Tek 4319 threads?
Date: 18 Jan 91 17:54:24 GMT
Sender: news at pdxgate.uucp
To: info-unix at sem.brl.mil
I have several applications that require the use of threads, which I would
like to port to a Tek 4319 box. Unfortunately, my lack of experience in this
sort of thing prohibits me from improvising. Anyone have any good ideas where
I might find good information on this, and what I might be able to do to
implement something like this? Has someone already hacked on this?
Any help would be appreciated. Thanx.
(example: XTank ... )
-e.b.
==============================================================================
Eric Berggren | "Round and round the while() loop goes;
Computer Science/Eng. | Whether it stops," Turing says,
berggren at eecs.cs.pdx.edu | "nobody knows."
-----------------------------
From: Tillmann Basien <tb at pemstgt.pem-stuttgart.de>
Subject: Why is there no NFS with XENIX
Keywords: NFS
Date: 18 Jan 91 17:54:54 GMT
To: info-unix at sem.brl.mil
Hy guys,
we have a great and phanastic network with SCO UNIX, ODT and XENIX.
But what we miss is NFS in XENIX.
As I know, for NFS you need FSS. This is not supported in XENIX.
So I think, that the FSS is needed only for the client. Why is
there no NFS-Server daemon in XENIX.
Who can help me !!
Tillmann
--
Dipl.-Ing. Tillmann A. Basien PEM Programmentwicklungsgesellschaft
Vaihinger Str.49, PostBox 810165 fuer Microcomputer mbH
FRG 7000 Stuttgart 80 voice: +49-711-713045 fax: +49-711-713047
-----------------------------
From: Tony Rick <tonyr at tekadg.adg.tek.com>
Subject: GDSII<->PostScript<->HPGL translation pgms wanted
Keywords: hpgl,postscript,gdsII,graphics,lsi,vlsi
Date: 18 Jan 91 18:01:56 GMT
Followup-To: poster
To: info-unix at sem.brl.mil
I am looking for programs that do GDSII<->HPGL and GDSII<->PostScript
translations. Do you know of any such animals (dare I say puppies?) and
from where they might be acquired? My preference is for public domain
sources, but any help at all would be appreciated. Please respond to
my email address. Thanks.
Tony Rick
Tektronix, Inc. Beaverton, OR
email:tonyr at tekadg.adg.tek.com
voice:503-627-2942
-----------------------------
From: Dana Eckart <dana at rucs.runet.edu>
Subject: Can UNIX pipe connections be compiled?
Date: 18 Jan 91 19:32:34 GMT
To: info-unix at sem.brl.mil
Does there exist a piece of software (or is it even possible) to compile
a pipe? In particular, suppose you had
ls -l | fgrep "Dec" | cut -f 4
is there anyway to compile the above pipeline so that the pieces can
communicate more quickly. I am looking for a general solution, not
one that works only for the above example.
The question arises because I have constructed some small programs which
become VERY slow when piped together. It appears that if I can get around
the slow speed of standard (character based) i/o that things will be MUCH
faster.
Although I suspect I am stuck (unless I rewrite my code - combining the
pieces programs into a single program), perhaps some kind netter will be
able to save me a great deal of grief.
Thanks in advance...
J Dana Eckart INTERNET: dana at rucs.runet.edu
SNAIL: P.O. Box 10865/Blacksburg, VA 24062-0865
-----------------------------
From: Barry Margolin <barmar at think.com>
Subject: Re: Can UNIX pipe connections be compiled?
Date: 18 Jan 91 22:43:23 GMT
Sender: news at think.com
To: info-unix at sem.brl.mil
In article <1991Jan18.193234.216 at rucs.runet.edu> dana at rucs.runet.edu (Dana Eckart) writes:
>Does there exist a piece of software (or is it even possible) to compile
>a pipe? In particular, suppose you had
>
> ls -l | fgrep "Dec" | cut -f 4
>
>is there anyway to compile the above pipeline so that the pieces can
>communicate more quickly. I am looking for a general solution, not
>one that works only for the above example.
I'm not really sure I (or you) understand what you expect the pipe to be
compiled into. On Unix, each program has to be run in its own process, so
they're going to have to use some form of inter-process communication to
feed the data to each other. There are shell script compilers, but all
they do is save the overhead of parsing the commands and interpreting shell
built-ins; the compiled script still runs each command in its own process
and sets up pipes for them to communicate.
>The question arises because I have constructed some small programs which
>become VERY slow when piped together. It appears that if I can get around
>the slow speed of standard (character based) i/o that things will be MUCH
>faster.
If the programs that are used in the pipeline do character-at-a-time I/O,
then speeding up the pipeline isn't going to help. Compiling the pipeline
wouldn't change the programs; they'll still be doing character I/O.
I strongly doubt that the speed of the pipe is the limiting factor; this is
a pretty simple mechanism whose performance is extremely important to most
Unix implementors. I just timed the following on a Sun-4/330 running SunOS
4.0.3:
cat file file file | cat >/dev/null
"file" is a 4Mb file on an NFS server. The SunOS version of "cat" uses
mmap() to read in files named as arguments, so once it is all paged into
memory (I ran the command until it got zero page faults) nearly all the
overhead should be in the pipe (about 95% of the CPU time was system time,
and I doubt I was spending much time in the null device driver). I was
getting about 4Mbyte/CPU-second throughput.
And I think most stdio implementations don't actually do
character-at-a-time I/O. getc() and putc() are usually implemented as
macros that read/write a buffer, and don't actually do any I/O until the
buffer is empty/full (putc()'s output buffer will also be flushed if you
call fflush()).
>Although I suspect I am stuck (unless I rewrite my code - combining the
>pieces programs into a single program), perhaps some kind netter will be
>able to save me a great deal of grief.
Have you actually profiled your programs and found that they are spending
most of their time doing I/O to pipes?
--
Barry Margolin, Thinking Machines Corp.
barmar at think.com
{uunet,harvard}!think!barmar
-----------------------------
From: Tom Christiansen <tchrist at convex.com>
Subject: Re: Can UNIX pipe connections be compiled?
Date: 18 Jan 91 23:05:30 GMT
Sender: news access account <usenet at convex.com>
Nntp-Posting-Host: pixel.convex.com
To: info-unix at sem.brl.mil
>From the keyboard of dana at rucs.runet.edu (Dana Eckart):
:Does there exist a piece of software (or is it even possible) to compile
:a pipe? In particular, suppose you had
:
: ls -l | fgrep "Dec" | cut -f 4
:
:is there anyway to compile the above pipeline so that the pieces can
:communicate more quickly. I am looking for a general solution, not
:one that works only for the above example.
:
:The question arises because I have constructed some small programs which
:become VERY slow when piped together. It appears that if I can get around
:the slow speed of standard (character based) i/o that things will be MUCH
:faster.
:
:Although I suspect I am stuck (unless I rewrite my code - combining the
:pieces programs into a single program), perhaps some kind netter will be
:able to save me a great deal of grief.
You're absolutely right that the generic
a | b | c | d | e | f | g | h > out
stream ends up being very slow.
In general, the answer to whether things like this can be automagically
compiled is no, because you can't know what all the pieces are a priori.
You'd have to be able to duplicate what all the components parts do.
However, do not give up hope. The perl langauge is particularly designed
to thing like that. The average shell script full of lots of pipes will,
when translated into perl, run much faster than originally. The
translation is usually pretty easy. Because perl is one program rather
than a dozen others (sh, awk, sed, tr, wc, sort, grep, ...), it is usually
clearer to express yourself in perl than in sh and allies, and often more
efficient as well. You don't need as many pipes, temporary files, or
separate processes to do the job. You don't need to go shoving your data
stream out to tr and back and to sed and back and to awk and back and to
sort back and then back to sed and back again. Doing so can often be
slow, awkward, and/or confusing.
For example, let's take the stream given above:
: ls -l | fgrep "Dec" | cut -f 4
With this, as with many of the simpler streams, you could really do this
in all in awk. (I say this is so Henry Spencer doesn't give me a rough
time at USENIX next week. :-)
ls -l | awk '/Dec/ { print $4 }'
(By the way, the cut command you gave above didn't do what I think
you actually wanted it to do.)
Now, I think what you are wanting to do here is eventually sum up
all the files that were touched in December.
ls -l | awk '/Dec/ { sum += $4 } END {print sum}'
Run time: .39u + .44s
I still haven't given ample motivation for using perl. That's because
in this case, you don't really need it. You asked for a general solution.
Many scripts have sed calls in them. If you have nawk or gawk, you
can do a lot of this, although not quite all.
Perl is conducive to the pipe-and-filter philosophy: I'll open
a pipe to ls.
#!/usr/bin/perl
open (PIPE, "ls -l|");
while (<PIPE>) { $sum += (split)[3] if /Dec/; }
print "$sum\n";
Run time: .06u + 06s
[I guess awk is just slower.]
But perl lets you get at things no version of awk does, because it
has most of the C library available to it. So, you could do it all
yourself if you wanted and not even call ls:
#!/usr/bin/perl
opendir (DIR, '.');
for $file (readdir(DIR)) {
next if $file =~ /^\./; # no dot files
($size, $mtime) = (lstat($file))[7,9];
($mon, $year) = (localtime($mtime))[4,5];
next unless $mon == 11 && $year == 90;
$sum += $size;
}
print "$sum\n";
Run time: .40u + .18s
More elaborate pipelines and larger data sets will show much more gain.
There's a little bit of a learning-curve to be able to generate fast code,
but in general it's pretty easy to get started on.
--tom
--
"Hey, did you hear Stallman has replaced /vmunix with /vmunix.el? Now
he can finally have the whole O/S built-in to his editor like he
always wanted!" --me (Tom Christiansen <tchrist at convex.com>)
-----------------------------
From: "Narayan S. Raja" <raja at bombay.cps.msu.edu>
Subject: Re: Can UNIX pipe connections be compiled?
Date: 19 Jan 91 07:27:55 GMT
Sender: news at msuinfo.cl.msu.edu
To: info-unix at sem.brl.mil
In article <1991Jan18.230530.9331 at convex>, (Tom Christiansen) writes:
< From the keyboard of dana at rucs.runet.edu (Dana Eckart):
< :Does there exist a piece of software (or is it even possible) to compile
< :a pipe? In particular, suppose you had
< :
< : ls -l | fgrep "Dec" | cut -f 4
< :
< :is there anyway to compile the above pipeline so that the pieces can
< :communicate more quickly. I am looking for a general solution, not
< :one that works only for the above example.
< In general, the answer to whether things like this can be automagically
< compiled is no, because you can't know what all the pieces are a priori.
However, wouldn't pipes be speeded up considerably
on a Sun by mounting /tmp as a tmpfs filesystem
(i.e. memory-based filesystem)? Apparently tmpfs
is *really* quick under SunOS 4.1.1.
Pardonnez-moi if this is a dumb suggestion.
Narayan Sriranga Raja.
-----------------------------
From: Guy Harris <guy at auspex.auspex.com>
Subject: Re: shell in programs
Date: 18 Jan 91 21:53:16 GMT
To: info-unix at sem.brl.mil
>No big problem if it doesn't. Just catch the ENOEXEC and do the shell call
>you would have done anyway.
Or, if you also want to run a command and have the system search $PATH
to see which one to run, if appropriate, rather than having to give a
full pathname, use "execvp()" which does the path search *and* the
catching of ENOEXEC for you....
-----------------------------
From: "Ronald S. Woan Jr." <woan at nowhere>
Subject: Re: exist enscript for sun4?
Date: 19 Jan 91 02:10:32 GMT
Sender: news at awdprime.uucp
Followup-To: comp.lang.postscript
To: info-unix at sem.brl.mil
shawn at litsun8.litsun.epfl.edu (Shawn Koppenhoefer) writes:
Shawn> does anyone know where I can get ENSCRIPT for sun4
Shawn> machines? the source would be fine (in fact, preferred!).
Shawn> I've tried using the archie facility at McGill but no
Shawn> luck in source or executable.
enscript is part of the transcript utilities from Adobe... You'll
need to buy/license it... A similar ASCII->PS filter is a2ps which
can be found at comp.sources.unix (or was it misc) archives...
--
+-----All Views Expressed Are My Own And Are Not Necessarily Shared By------+
+------------------------------My Employer----------------------------------+
+ Ronald S. Woan woan at peyote.cactus.org or woan%austin at iinus1.ibm.com +
+ other email addresses Prodigy: XTCR74A Compuserve: 73530,2537 +
-----------------------------
From: "John A. Weeks III" <john at newave.uucp>
Subject: Re: exist enscript for sun4?
Date: 19 Jan 91 04:01:54 GMT
Followup-To: comp.lang.postscript
To: info-unix at sem.brl.mil
In article <SHAWN.91Jan15161239 at litsun8.litsun.epfl.edu> shawn at litsun.epfl.ch:
> does anyone know where I can get ENSCRIPT for sun4 machines?
> the source would be fine (in fact, preferred!).
> Does anyone know where I should be looking? if at all??
In yer phone book for Adobe Systems. Enscript is part of a software
package called Transcript. It is not public domain, and sources are
not readily available (if at all). As an alternative, call your Sun
dealer and inquire about their postscript printing packages.
-john-
--
===============================================================================
John A. Weeks III (612) 942-6969 john at newave.mn.org
NeWave Communications ...uunet!rosevax!tcnet!wd0gol!newave!john
===============================================================================
-----------------------------
From: Rich Stevens <rstevens at noao.edu>
Subject: Re: SUMMARY: A Good Network Programming Book.
Date: 19 Jan 91 05:30:13 GMT
To: info-unix at sem.brl.mil
In article <590 at siswat.UUCP> buck at siswat.UUCP (A. Lester Buck) writes:
>
> Is the massive amount of sample code available in electronic form anywhere?
It's all at uunet.uu.net: you can FTP the file: pub/netprog.tar.Z
or UUCP the file: uunet!~/pub/netprog.tar.Z.
Rich Stevens (rstevens at noao.edu)
-----------------------------
From: Rich Stevens <rstevens at noao.edu>
Subject: Re: Setting my prompt
Date: 19 Jan 91 05:51:36 GMT
To: info-unix at sem.brl.mil
Case conversion in awk is hard. Bentley & Kernighan finish their
paper "Tools for Printing Indixes" with the comment: "there is no
good way to convert cases in awk." The actual code that they
use in this paper to convert case is:
BEGIN { FS = "\t"
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz "
# set upper["a"] = "A"
for (i = 1; i <= 27; i++) upper[substr(s,i+27,1)] = substr(s,i,1)
# set lower["a"] = lower["A"] ="a"
for (i = 1; i <= 27; i++) {
lower[substr(s,i,1)] = substr(s,i+27,1)
lower[substr(s,i+27,1)] = substr(s,i+27,1)
}
}
(Ugh) This should work with any version of awk.
But, the newer releases of awk (the "nawk" available from the
Toolchest) do contain new functions toupper() and tolower().
GNU awk also contains these new functions. As I recall, only
versions of nawk that were obtained from the Toolchest since
about 11/89 contain these functions. I see that the version
of nawk with SunOS 4.1 doesn't yet have these functions.
These functions weren't in awk when the book was written by
AK&W, so they're still somewhat unknown. I wonder if they're
in the new O'Reilly book on awk ?
Rich Stevens
-----------------------------
End of INFO-UNIX Digest
***********************
More information about the Comp.unix.questions
mailing list