/** * Simple implementation of the ubiquitous grep command. * First argument is the regular expression to search for (remember to * quote and/or escape as appropriate). All following arguments are * filenames to read and search for the regular expression. * * Created: April, 2002 * @author Ron Hitchens (ron@ronsoft.com) * @version $Id: SimpleGrep.java,v 1.1 2002/05/07 02:21:08 ron Exp $ */ public static void main (String [] argv) throws Exception { if (argv.length < 2) { // 如果参数行没有输入参数,结束程序 System.out.println ("Usage: regex file [ ... ]"); return; }