[lug] Odd Shell Script Queries

Matt Thompson thompsma at jilau1.colorado.edu
Tue Jan 18 15:09:39 MST 2005


Oh knowledgeable ones, I have a couple shell script queries.  First, the
one I believe there might be an answer to.

Is there an easy way to batch-convert filenames from using dots as
separators to underscores *while leaving the final dot*?  That is, I
know I can do:

> echo "ibr-.355.3graph.notitle.pdf"| tr '\.' '_'
ibr-_355_3graph_notitle_pdf

but now the final "." is an "_".  I'm sure I could use Perl or something
to chomp off the last bit, do the translation, and re-concatenate the
end back, but I thought I'd ask if someone here knew a nice way.  (If
you're wondering, LaTeX is b0rking on my habit of using dots in
filenames.)


My second script question is a bit more involved.  Namely, at my work we
have multiple printer queues.  Two are a LaserJet and Color LaserJet,
with the Color one being more expensive.  I began to wonder if there was
a script that parsed a PS or PDF file in such a way that only pages with
color are sent to a color printer, while the rest are sent to the mono.
I'm not enough of a PS/PDF guru to know if this is even possible, but
for a large, mainly-text file (say a thesis) with a few color diagrams,
it would be interesting to know if it exists.

Thanks for the help,
Matt

-- 
Learning just means you were wrong and they were right. - Aram
   Matt Thompson -- http://ucsub.colorado.edu/~thompsma/
   440 UCB, Boulder, CO  80309-0440
   JILA A510, 303-492-4662
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3327 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20050118/d25d455b/attachment.bin>


More information about the LUG mailing list