I am writing a script that will take the file name as an argument, find the word a specific word at the beginning of each line - the word ATOM in this case - and print the values from specific columns.
$FILE=*.pdb *
if test $# -lt 1
then
echo "usage: $0 Enter a .PDB filename"
exit
fi
if test -r $FILE
then
grep ^ATOM $FILE | awk '{ print $18 }' | awk '{ print NR $4, "\t" $38,}'
else
echo "usage: $FILE must be readable"
exit
fi
I am having trouble figuring out three issues:
- How to use awk to print only lines containing ATOM as the first word
- How to use awk to print only certain columns of rows that match the above criteria, in particular columns 2-20 and 38-40
- How can I indicate that this should be a pdb file? * .pdb *
Koala source
share