home *** CD-ROM | disk | FTP | other *** search
/ ftp.cse.unsw.edu.au / 2014.06.ftp.cse.unsw.edu.au.tar / ftp.cse.unsw.edu.au / pub / doc / languages / perl / nutshell / ch1 / baregrep < prev    next >
Encoding:
Text File  |  1992-10-18  |  243 b   |  8 lines

  1. #!/usr/bin/perl
  2. $pattern = shift(@ARGV); # Extract first argument into $pattern.
  3. while (<>) {             # Treat the rest of @ARGV as filenames.
  4.     if (/$pattern/) {    # If the pattern matches...
  5.     print;           # Print the line.
  6.     }
  7. }
  8.