From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,b0266b3ac953310a,start X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,b0266b3ac953310a,start X-Google-Attributes: gid1164f8,public From: fairfield@sldb4.slac.stanford.edu Subject: Re: Need line counting program for Alpha OpenVMS Date: 1997/11/17 Message-ID: <1997Nov17.183728.1@sldb4.slac.stanford.edu>#1/1 X-Deja-AN: 290320330 References: <3470F85B.20B4@snipak.netik> Organization: Stanford Linear Accelerator Center Newsgroups: comp.os.vms,comp.sys.dec In article <3470F85B.20B4@snipak.netik>, Peter Mroz writes: > I need a fast line counting program. I wrote a simple C program that > reads a file in byte by byte, and increments a counter when it > encounters a newline. However, it's pretty slow on large files. Has > someone written a program that takes advantage of VMS system service > calls to perform the same task? How about: $ search/stat/out=nl: the.file "" It's very fast, and the number of records searched, i.e., the count of lines in the file, appear in the last line of the output. > Also, I've got a version of the Unix "tail" command that runs under VMS, > but not Alpha OpenVMS. It's pretty handy for looking at the last n > lines of a batch log file for a long running job. Has anyone gotten > this to work on Alpha OpenVMS? I can post the source if anyone's > interested. There are various TAIL and MORE, etc., varients available for VMS. However, since you mention Alpha, VMS since V6.1 (I think) has had TYPE/TAIL[=nn] and TYPE/PAGE (and TYPE/TAIL/PAGE, etc.) which _mostly_ do the job. TYPE/TAIL and TYPE/PAGE (in fact, the /PAGE qualifier to a whole bunch of VMS verbs) first appeared in VMS 6.1 (or 6.2, I don't recall which at the moment) on _both_ VAX and Alpha. Someone is bound to jump in here and point out that, for certain file organizations, TYPE/TAIL won't work, but in those (rare?) cases, one of the freeware TAIL programs will do the job. See any of the fine VMS freeware sites in your area. :-) Andy Harper's server, ftp2.kcl.ac.uk, has two TAIL varients and two MORE varients (MOST and SMORE). Hunter Goatley's server, ftp.wku.edu, alos has SMORE nad MOST. So you really don't need your unix ports, VMS has them already (unless you're running on a very old version), either built in or as freeware. -Ken -- Kenneth H. Fairfield | Internet: Fairfield@Slac.Stanford.Edu SLAC, P.O.Box 4349, MS 46 | DECnet: 45537::FAIRFIELD (45537=SLACVX) Stanford, CA 94309 | Voice: 650-926-2924 FAX: 650-926-3515 ------------------------------------------------------------------------- These opinions are mine, not SLAC's, Stanford's, nor the DOE's...