title: Print columns with Awk or Cut?
body: <p>I'm writing a script that will take a filename as an argument, find a word a specific word at the beginning of each line - the word ATOM, in this case - and print the values from specific columns.</p>
  
  <pre><code>$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
  </code></pre>
  
  <p>I'm having trouble figuring out three problems:</p>
  
  <ol>
  <li>How to use awk to print only lines that contain ATOM as the first word</li>
  <li>How to use awk to print only certain columns from the rows that match the above criteria, specifically columns 2-20 and 38-40 </li>
  <li>How can I indicate this must be a pdb file? *.pdb * </li>
  </ol>