title: UNIX: Using awk commands to filter lists?
body: <p>I'm wondering what is the syntax error in my command I'm using.</p>
  
  <p>In the current directory I use the command <code>ls -l</code> to retrieve file permissions in my directory.</p>
  
  <p>How would I do a query to see which files are readable, writeable, and executable by the user and then print a filtered list using awk?</p>
  
  <p>I know the bits I'm interested in are the second, third, and fourth.</p>
  
  <p>For example,</p>
  
  <pre><code>-rw-r----- .. .. .. ..
  </code></pre>
  
  <p>or</p>
  
  <pre><code>drw-r----- .. .. .. ..
  </code></pre>
  
  <p>I have an awk command as follows:</p>
  
  <pre><code>ls -l | awk '{if{$1 == /.rwx....../}print "line"}'
  </code></pre>
  
  <p>I've tried many things but there's still a syntax error.</p>
  
  <p>Any help is greatly appreciated! Thanks in advance!</p>