by Christine
Vogel, I Yr PhD student with Dr. Cyrus
Chothia
Structural Studies Division
MRC-Laboratory of Molecular Biology
http://www.mrc-lmb.cam.ac.uk/genomes/cvogel/edtut.htm
eg: %> cut -c2-5 filename
this means: cut column numbers from 2 to 5 (all inclusive) from the file filename.
eg: %> cut -f3-4 filename
if the filename has field delimiters, then individual fields can be cut out using the -f option.Point to remember:
A file can have many fields and the basic unit of a field is a column. Fields are a set
of columns which are delimited with a special symbol.
madan;SS;MRC-LMB
christine;SS;MRC-LMB
This particular examples has 3 fields which are 'delimited' by a ;
so to get field number three, you should type
eg: %> cut -f4 -d';' filename
eg: %> paste file1 file2 > pastedfile
eg: %> paste -d';' file1 file2 > pastedfile
the last command will paste two files delimited by a ';'
This command is used to translate one character to another. If you want all upper
case to be translated to lower case, then you have to type the following:
eg: %> tr A-Z a-z < filename
eg: %> cut -f2 -d';' filename | tr a-z A-Z
the last command will cut field number 2 from the file 'filename' which has fields
delimited by a ';'. The standard output is given to the translate command which converts all the lower case to upper case letters.