Dealing with Text in Unix!
This site is still under development ...
Overview
Text files, like the rest of the files in the
digital world of computing,
are transported in either ascii or binary format. When
treating problems
that arise out of text transportation it is essential
to make the
distinction between these file types
Encoded and compressed binary files
Text files from
Mac and Windows Platforms
Viewing text files in unix
Printing out text files
Images (Extra)
Encoded and Compressed binary files
-
USE: gunzip file.Z
-
OR : uncompress file.Z
-
-
file.z
USE: unpack file.z
-
file.gz
-
-
file.tgz (gzipped tar file)
-
USE: gunzip file.tgz
THEN USE: tar -xvf file.tar to extract the gzipped file
-
OR : tar -xzvf filet.gz
-
which combines the unzipping(switch -z) with extraction(-x) of
-
the file.
-
-
file.tar (tar file)
-
USE: tar -xvf file.tar
to extract the tar file
-
-
file.mm
-
USE: uudeview file.mm
-
OR: munpack file.mm
-
OR: metamail file.m
-
OR: unzip filename
-
-
file.uu
-
USE: uudeview file.uu
-
OR: uudecode file.uu
-
-
file.bin
-
-
file.hqx
-
USE: uudeview file.hqx
-
OR: unhex file.hqx
-
Other interesting conversions with hex and
binary files:
unhex file.hqx
: decodes a hexed file
binhex file.bin
: hexes a macbinary file
unbin file.bin
: decodes a macbinary file
hqx2bin file.hqx : changes
hex file to macbinary format
Text
files from Mac or Dos Platforms:
Key: Different platforms use different
characters to mark end of line.
Viewing text in Unix:
Postscript files : file.ps
To view text with its format (ie. as it will appear when
printed out).
USE: 'gs' or 'gv' (ghost viewer) as follows -
gs file.ps
gv file.ps
OR convert the text file into ascii format which could be
viewed with
any of the editing utilities like pico, emacs, vi.
ps2ascii file.ps > file
emacs file
pdf files : file.pdf
Can change to postscriopt file and use the above procedure
to view the file:
acroread -toPostScript file.pdf
OR
View with adobe acrobat viewer or ghostviewer (gv):
acroread file.pdf
gv file.pdf
Printing out text files in Unix
postcript files :
-
lpq -Pname file
-
where name is a printer name (For sweet hall printers,
name = sweet1, 2, 3 or 4
pdf files :
-
can use acroread to view the file and use the printing
option to print it out
-
can convert file to postcript and print out as a postcript
file.
-
can type the command lp -d name, where name is printer
name(For SWEET HALL printers, name = sweet1, 2,3 or 4)
Viewing image files
-
use 'gv imagefile'
-
can use 'xv imagefile'
-
for multiple frame viewing can use 'cv frames'
(For comments or contributions, CONTACT vusi@cs.stanford.edu
Remember, our site can only get better with your positive input.)