Archive for the 'Shell Script' Category

Changing file names in a directory

Thursday, July 15th, 2004

Here I am changing a whole directory of file names. I am changing the extension of any file with the .tif extension to .jpg.
ls *.jpg | awk ‘{print(”mv “$1″ “$1)}’ | sed ’s/.jpg/.tif/2′ | /bin/sh
Of course you can change the sed regular expression to change it to whatever you want to change the file names [...]

Printing a man page to a postscript printer

Wednesday, July 14th, 2004

To use the terminal to print a postscript page of a man page use these commands:
groff -Tps -man /usr/share/man/man7/groff.7 | lpr -P LaserWriter_8500
I’m using an Apple Laserwriter 8500. To find the printers available to your lpr command use the command lpstat -a to list them. If there isn’t a printer available, you will need to [...]