Subject: grepping summary

thanks to all who responded to my request for grepping under a dos environment with the following syntax : < grep - r < fn1 > < fn2 > fn3 > < where fn1 is the file with the set of strings to be grepped > < fn2 is the data-base > < fn3 is the output . > with the suggestions and help that i have got , i have literally " grepped " all about grep . thanks a lot i got a whole lot of answers which i am summarising below : 1 . the first was to use perl script to write my own grep : for both unix and dos , perl is a language that will easily allow to create a small program that will do what you ask . more information about perl , including free downloads for many environments , can be gotten from the perl language home page , http : / / www . perl . com / perl / index . html . 2 . the second suggestion was similar in nature : use awk and lex tools for the job . 3 . under unix environment three types of grep were proposed : a . egrep egrep - f fn1 fn2 > fn3 where fn1 is a file containing the search patterns ( one per line ) . if you only want to search for literal strings ( no special characters ) then you can use fgrep instead of egrep . do ' man grep ' for more details , b . fgrep fgrep - f patt-file - name < database-to - search > results-file will work , assuming patt-file - name is a file of _ strings _ ( regular expressions containing metacharacters are not allowed by fgrep . ) say man fgrep to get the details . one hitch however it will only match strings , not regular expressions . c . sgrep the sgrep utility ( not standard unix ) permits complex ( and nested ) patterns to be searched for . 4 . under dos the gnu tools are now available under dos ; gnu has only one grep and lets you do this ( according to the manual ) with grep - f f1 f2 > f3 this works and i have used it with success . thanks to andreas mengel incidentally egrep , sgrep and fgrep versions for dos exist and can be found at : ftp . rediris . es / mirror / simtelnet / gnu / gnuish / grep15 . zip thanks to susana sotelo docio 5 . another suggestion was to use sed sed - n - f < file > permits many patterns to be searched for ( with some problems when multiple matches occur on a line . 6 . another solution under dos was to grep for a large number of strings at once in a ` regular expression ' . a second alternative was to batch-file the operation , which i am using at present as a solution , but wanted something more functional . 7 . a commercial solution was also proposed : mks ( mortice - kern ) in canada makes a commercial set of unix apps and commands for use in dos and windows environments , including ksh , awk , grep , gres . their grep syntax is : grep - f pattfile file > output _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ many thanks to : martin wynne < eiamjw @ comp . lancs . ac . uk > will dowling < willd @ spectranet . ca > kevin bretonnel cohen < kevin @ cmhcsys . com > mark liberman < myl @ unagi . cis . upenn . edu > john e . koontz koontz @ boulder . nist . gov peter hamer < p . g . hamer @ nortel . co . uk > stuart luppescu < s-luppescu @ uchicago . edu > stephen p spackman < stephen @ softguard . com > d . lee < d . lee @ lancaster . ac . uk > chris culy < cculy @ blue . weeg . uiowa . edu > david palmer < palmer @ linus . mitre . org > shravan vasishth < vasishth @ ling . ohio-state . edu > susana sotelo doc ' io " < fesdocio @ usc . es > andreas mengel < mengel @ babylon . kgw . tu-berlin . de > for their prompt and helpful replies to my query .
