2007-02-06

less

It is possible to configure less to view several file formats in the console. This makes things easier only having to use the one command. Recently I have setup less to view .rtf .doc and .iso.

Install less, antiword, unrtf and cdrtools.

Next make sure less is setup to use the lesspipe.sh script. From the shell type
echo $LESSOPEN
You should see something like this:
$ echo $LESSOPEN
|/usr/bin/lesspipe.sh %s

Next, open /usr/bin/lesspipe.sh, find the *gif and add the following lines above, you file should wind up looking like this:

*.doc) antiword "$1";;
*.rtf) unrtf --nopict --text "$1" ;;
*.iso) isoinfo -d -i "$1" ; isoinfo -lJ -i "$1";;
*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)

It should now be possible to 'less word.doc' 'less word.rtf' or 'less cd.iso'.

No comments: