The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 01-02-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by nj78 View Post
If you are familiar with egrep and regular expressions, then just cat the file and pipe to egrep -v to remove what you don't need. Good exercise to learn this, plenty of material to find using google.

Don't cat the file. Use the filename as the final argument to grep.

However, for this exercise, awk is better:

Code:
awk -F '_list' '
 { num = $2; sub( /.prn/, "", num ); num = num + 0 }
 num < 21 || num > 37
' "$FILE"