From torfree.net!af137 Sat Nov 2 09:13:23 1996 Return-Path: Received: by leibniz.math.fu-berlin.de (/\=-/\ Smail3.1.18.1 #18.14) id ; Sat, 2 Nov 96 09:13 MET Received: by sheppard.torfree.net (Smail3.1.28.1 #6) id m0vJb8p-000QvCC; Sat, 2 Nov 96 03:09 EST Date: Sat, 2 Nov 1996 03:09:19 -0500 (EST) From: Al Aab Subject: To: seders -- Casper Boden-Cummins , Casper BodenCummins , "David E. O'Brien" , Felix von Leitner , Mark Katz , jeff smith , acosta andrew , Gerard Piette , Barry Couper , "John S. Anderson" , "Peter L. Buschman" , Edgar Allen , "James W. Gifford" , Yiorgos Adamopoulos , seders moderator , Sverre Slotte , walter briscoe , Greg Ubben , Bojan Zdrnja , Andru1 Luvisi , David Briars , Warren Dale , brian s hiles , "\"Dros, Brienen J.\"" , Sven Guckes , David Jeffers Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Status: RO Content-Length: 13509 Lines: 298 here are some quotes from usenet =-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- al aab, seders moderator sed u soon it is not zat we do not see the s o l u t i o n -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ From torfree!news.rogerswave.ca!news.uunet.ca!world2.bellatlantic.net!news2.cais.net!news.cais.net!news.mathworks.com!howland.erols.net!feed1.news.erols.com!arclight.uoregon.edu!news.ibm.net.il!news.biu.ac.il!news.huji.ac.il!bagel!scorpios Sat Oct 26 05:0 5:20 1996 Xref: torfree comp.unix.questions:28609 Path: torfree!news.rogerswave.ca!news.uunet.ca!world2.bellatlantic.net!news2.cais.net!news.cais.net!news.mathworks.com!howland.erols.net!feed1.news.erols.com!arclight.uoregon.edu!news.ibm.net.il!news.biu.ac.il!news.huji.ac.il!bagel!scorpios From: scorpios@bagel.cs.huji.ac.il (Nir Soffer) Newsgroups: comp.unix.questions Subject: Re: sed question Date: 17 Oct 1996 20:54:52 GMT Organization: Hebrew University, Jerusalem Lines: 32 Message-ID: <5466es$6qp@news.huji.ac.il> References: <544g59$f92@ferrari.NetXpress.com> NNTP-Posting-Host: cs4.cs.huji.ac.il X-Newsreader: TIN [version 1.2 PL2] Adam Bolduc (abolduc@netxpress.com) wrote: : sed 's/1 of 1/$CURRENT_NUM of $MAX_NUM/g' label_file > new_label_file : Every time I try it I get : $CURRENT_NUM of $MAX_NUM : instead of : 1 of 3 Use "'s instead of ''s :) '= single quotes "= double qoutes single quotes in the shell relay the information 'as-is', without any interopolation or parsing. Double quotes should allow variable interpolation. : Adam Bolduc : abolduc@netxpress.com G'luck, Nir. -- Nir Soffer AKA ScorpioS. scorpios@cs.huji.ac.il -=- http://www.cs.huji.ac.il/~scorpios/ 'Beavis! Fire photon torpedos! Uhhh... Make them go that way!'. =-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- al aab, seders moderator sed u soon it is not zat we do not see the s o l u t i o n -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ >From torfree!news.rogerswave.ca!n2tor.istar!milkyway.com!n3ott.istar!baxter.net!n3tor.istar!tor.istar!east.istar!newsjunkie.ans.net!newsfeeds.ans.net!news.rmii.com!thoth.nilenet.com!news1.good.net!news.good.net!www.nntp.primenet.com!nntp.primenet.com!arcl ight.uoregon.edu!feed1.news.erols.com!howland.erols.net!newsfeed.internetmci.com!in2.uu.net!sys14!news Wed Oct 30 16:41:12 1996 Xref: torfree comp.unix.shell:17087 Newsgroups: comp.unix.shell Path: torfree!news.rogerswave.ca!n2tor.istar!milkyway.com!n3ott.istar!baxter.net!n3tor.istar!tor.istar!east.istar!newsjunkie.ans.net!newsfeeds.ans.net!news.rmii.com!thoth.nilenet.com!news1.good.net!news.good.net!www.nntp.primenet.com!nntp.primenet.com!arc light.uoregon.edu!feed1.news.erols.com!howland.erols.net!newsfeed.internetmci.com!in2.uu.net!sys14!news From: Ken Kuhle Subject: Re: How to identify Postscript files? X-Nntp-Posting-Host: txs07.tx.deere.com Content-Type: text/plain; charset=us-ascii Message-ID: <3270BCBE.62F1@tx.deere.com> Sender: news@deere.com Content-Transfer-Encoding: 7bit Organization: CES Computers Inc. References: Mime-Version: 1.0 Date: Fri, 25 Oct 1996 13:12:30 GMT X-Mailer: Mozilla 2.01 (X11; I; SunOS 5.5 sun4m) Lines: 58 Hagen Ross wrote: > > [ I apologize if this post appears twice. When posting yesterday I > lost the connection to the NNTP server, so this is a second try.] > > >>>>> In article , > brankin@fwl.org (Brian Rankin) writes: > > > I need to identity PS files via a shell script. I can to this just > > fine with: > > > var=`cat $TMP3 | sed -n '1,1p' | cut -c1-2` > > if test "$var" = "%!"; then echo "Postscript"; fi > > > However: This fails on some PS files, with sed not finding a first > > line in the file. I can't look at those PS files with vi (I get a > > "Line too long" message) , yet they are valid PS files which print > > just fine! > > Thats funny, because the PostScript Language DSC Specification at > > http://www.lumcorp.com/Web/PSWeb/DSC1.html#Constraints > > has this to say about the line length of conforming PostScript: > > DSC> To provide compatibility with a large body of existing > DSC> application and document manager software, a conforming > DSC> PostScript language document description does not have lines > DSC> exceeding 255 characters, excluding line-termination characters. > > Obviously a PS filter should reject garbage without raising an error, > even when fed files with arbitrary long lines. Here are two > suggestions, which you might want to try. > > The head(1) command on SunOS appears to have an implicit maximum line > length of 1023 characters. But it doesn't complain if fed longer > lines. The rest is being silently ignored. > > if head -1 $TMP3 | egrep -s "^%!" ;then > echo "Postscript"; > fi > > This one uses dd(1) to only look at the first two bytes. It should > work even on arbitrary large files without newlines. > > if [ "`dd bs=2 count=1 <$TMP3 2>/dev/null`" = "%!" ] ;then > echo "Postscript"; > fi > > HTH > -- > Hagen Ross Alfred-Wegener-Institut f"ur > mailto:ross@AWI-Bremerhaven.de Polar- und Meeresforschung > phone: +49 471 4831 496 D27515 Bremerhaven How about the file command. file refback.ps refback.ps: PostScript document =-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- al aab, seders moderator sed u soon it is not zat we do not see the s o l u t i o n -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ >From torfree!news.rogerswave.ca!news.uunet.ca!world2.bellatlantic.net!news2.cais.net!news.cais.net!hunter.premier.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!newsfeed.internetmci.com!portal.gmu.edu!news Wed Oct 30 16:41:12 1996 Xref: torfree comp.unix.shell:17113 Path: torfree!news.rogerswave.ca!news.uunet.ca!world2.bellatlantic.net!news2.cais.net!news.cais.net!hunter.premier.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!newsfeed.internetmci.com!portal.gmu.edu!news From: desrosde@unconfigured.xvnews.domain (Donald Desrosiers (STAFF)) Newsgroups: comp.unix.shell Subject: Re: How to identify Postscript files? Date: 25 Oct 1996 16:24:55 GMT Organization: SITE at George Mason University Lines: 49 Message-ID: <54qpkn$75l@portal.gmu.edu> References: Reply-To: desrosde@unconfigured.xvnews.domain NNTP-Posting-Host: curie.site.gmu.edu Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit In article , brankin@fwl.org (Brian Rankin) writes: >I need to identity PS files via a shell script. I can to this just fine with: > >var=`cat $TMP3 | sed -n '1,1p' | cut -c1-2` >if test "$var" = "%!"; then echo "Postscript"; fi > Unfortunately, while the specs for PostScript call for one thing, printers do not always rigorously enforce the standards. And PostScript is sufficiently general that one size may or may not fit all. PostScript files are supposed to be identified by a header. Documents which conform exactly to the Adobe specs may use the %!PS-Adobe-### header, where ### is the version number (i.e. 3.0). A non-conforming document is recognized by the header %!. The difference between a conforming and a non-conforming document are not relevant here. Where the header is supposed to go is also not well defined. In some places it is supposed to be on the first line. In other cases it should be on the first line which contains text. Sometimes this is rigorously defined by the printer itself. To further complicate matters, some printers (one of the QMS printers comes to mind) would interpret any document with the strings "Adobe", "PostScript", or "PS" in the first line as a PostScript document. It doesn't seem to matter if the initial %! is included. Something like: cat file | # gratuitious deliberately inserted here grep -v "^$" | head -1 | cat -c1-2 and comparing the results to "%!" will get you close, but may not be foolproof. -- ------------------------------------------------------------------------ Donald Desrosiers desrosde@site.gmu.edu ------------------------------------------------------------------------ We all know that dragons don't exist. But if you look carefully at the problem you will see there are in fact three distinct types of dragons, the mythical, the hypothetical, and the chimerical. Each doesn't exist, but each doesn't exist in different way. ------------------------------------------------------------------------ =-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- al aab, seders moderator sed u soon it is not zat we do not see the s o l u t i o n -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ >From torfree!news.rogerswave.ca!n2tor.istar!tor.istar!east.istar!n1tor.istar!milkyway.com!n3ott.istar!news.magmacom.com!news.cais.net!newshub.sdsu.edu!newshub.csu.net!csulb.edu!hammer.uoregon.edu!arclight.uoregon.edu!enews.sgi.com!news.mathworks.com!howla nd.erols.net!EU.net!Norway.EU.net!sn.no!nntp.uio.no!nntp.zit.th-darmstadt.de!fu-berlin.de!uniol!uni-erlangen.de!news.dfn.de!news.dkrz.de!news.dkrz.de!ross Wed Oct 30 16:41:12 1996 Xref: torfree comp.unix.shell:17088 Path: torfree!news.rogerswave.ca!n2tor.istar!tor.istar!east.istar!n1tor.istar!milkyway.com!n3ott.istar!news.magmacom.com!news.cais.net!newshub.sdsu.edu!newshub.csu.net!csulb.edu!hammer.uoregon.edu!arclight.uoregon.edu!enews.sgi.com!news.mathworks.com!howl and.erols.net!EU.net!Norway.EU.net!sn.no!nntp.uio.no!nntp.zit.th-darmstadt.de!fu-berlin.de!uniol!uni-erlangen.de!news.dfn.de!news.dkrz.de!news.dkrz.de!ross From: ross@AWI-Bremerhaven.de (Hagen Ross) Newsgroups: comp.unix.shell Subject: Re: How to identify Postscript files? Date: 25 Oct 1996 22:10:15 +0200 Organization: Alfred-Wegener-Institut f"ur Polar- und Meeresforschung Lines: 15 Sender: ross@tphs20.AWI-Bremerhaven.de Message-ID: References: <3270BCBE.62F1@tx.deere.com> Reply-To: ross@AWI-Bremerhaven.de NNTP-Posting-Host: tphs20.awi-bremerhaven.de Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit In-reply-to: Ken Kuhle's message of Fri, 25 Oct 1996 13:12:30 GMT X-Newsreader: Gnus v5.0.15 >>>>> Regarding Re: How to identify Postscript files?; Ken Kuhle adds: > How about the file command. > file refback.ps > refback.ps: PostScript document It could lie to you, if you are looking at a symbolic link. And you can't use file(1) if the data you are processing are coming from a pipe. -- Hagen Ross Alfred-Wegener-Institut f"ur mailto:ross@AWI-Bremerhaven.de Polar- und Meeresforschung phone: +49 471 4831 496 D27515 Bremerhaven =-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- al aab, seders moderator sed u soon it is not zat we do not see the s o l u t i o n -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ >From torfree!news.rogerswave.ca!n2tor.istar!tor.istar!east.istar!newsjunkie.ans.net!newsfeeds.ans.net!philabs!blanket.mitre.org!news.mathworks.com!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!news-peer.gsl.net!news.gsl.net!usenet.eel.ufl.edu! warwick!niss!bath.ac.uk!ccsis Wed Oct 30 16:41:12 1996 Xref: torfree comp.unix.shell:17099 Newsgroups: comp.unix.shell Path: torfree!news.rogerswave.ca!n2tor.istar!tor.istar!east.istar!newsjunkie.ans.net!newsfeeds.ans.net!philabs!blanket.mitre.org!news.mathworks.com!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!news-peer.gsl.net!news.gsl.net!usenet.eel.ufl.edu !warwick!niss!bath.ac.uk!ccsis From: ccsis@bath.ac.uk (Icarus Sparry) Subject: Re: How to identify Postscript files? Organization: Bath University Computing Services, UK Message-ID: References: <326FE02F.74E@world.std.com> Date: Fri, 25 Oct 1996 22:55:26 GMT Lines: 17 In article <326FE02F.74E@world.std.com>, David Boyce wrote: >Brian Rankin wrote: >> >> I need to identity PS files via a shell script. I can to this just fine with: >> >> var=`cat $TMP3 | sed -n '1,1p' | cut -c1-2` >> if test "$var" = "%!"; then echo "Postscript"; fi > >Please read previous (or subsequent) articles with the subject line >"This week's Useless Use of Cat Award goes to ...". We can also award a 'Useless use of cut award here'! var=`sed -n -e'1{' -e's/^\(..\).*/\1/p' -eq -e' }'` Icarus =-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- al aab, seders moderator sed u soon it is not zat we do not see the s o l u t i o n -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ http://www.wollery.demon.co.uk http://www.math.fu-berlin.de/~guckes/sed/