PropertyValue
rdfs:label
  • Grep
  • Grep
rdfs:comment
  • grep is a command line utility originally written for use with the Unix operating system. The default behaviour of grep takes a regular expression on the command line, reads standard input or a list of files, and outputs the lines containing matches for the regular expression. The name comes from a command in the Unix text editor ed that takes the form: g/re/p This means "search globally for matches to the regular expression re, and print lines where they are found". There are various command line switches available when using grep that modify the default behavior.
  • Object: grep.
  • Grep – polecenie występujące w Unixie i systemach pochodnych, które z danego tekstu pokazuje jedynie linie, które pasują do wzorca
  • grep is a Unix command-line tool to search in files using regular expression. In NetHack, most of the useful source is in src/*.c and include/*.h, thus you can grep the sources like this: $ cd /path/to/nethack-3.4.3 $ grep -n regular-expression */*.{c,h} Here is an example of searching for "Drow" in an unbuilt copy of the SLASH'EM sources: It is sometimes useful to use grep to search for in-game messages. Want to know what a "wrenching sensation" is? Try this... $ grep -n 'eating the little dog' */*.{c,h} $ A look around eat.c#line486 (in vanilla 3.4.3) shows the following:
owl:sameAs
dcterms:subject
dbkwik:linux/property/wikiPageUsesTemplate
dbkwik:pl.linux/property/wikiPageUsesTemplate
abstract
  • grep is a command line utility originally written for use with the Unix operating system. The default behaviour of grep takes a regular expression on the command line, reads standard input or a list of files, and outputs the lines containing matches for the regular expression. The name comes from a command in the Unix text editor ed that takes the form: g/re/p This means "search globally for matches to the regular expression re, and print lines where they are found". There are various command line switches available when using grep that modify the default behavior.
  • Object: grep.
  • grep is a Unix command-line tool to search in files using regular expression. In NetHack, most of the useful source is in src/*.c and include/*.h, thus you can grep the sources like this: $ cd /path/to/nethack-3.4.3 $ grep -n regular-expression */*.{c,h} Here is an example of searching for "Drow" in an unbuilt copy of the SLASH'EM sources: $ cd /path/to/slashem-0.0.7E7F2 $ grep -n Drow */*.{c,h} src/u_init.c:1343: /* Drows can recognize all droven objects */ src/uhitm.c:40:/* Used to control whether Drow's sleep attack should succeed. */ include/you.h:356: /* KMH -- Drow is now its own role... */ It is sometimes useful to use grep to search for in-game messages. Want to know what a "wrenching sensation" is? Try this... $ cd /path/to/nethack-3.4.3 $ grep -n 'wrenching sensation' */*.{c,h} src/sit.c:248: You_feel("a wrenching sensation."); src/spell.c:116: You_feel("a wrenching sensation."); src/teleport.c:847: You_feel("a wrenching sensation."); src/teleport.c:869: You_feel("a wrenching sensation."); It can sometimes be difficult to find something successfully with grep. For example, a grep on 'You feel a wrenching sensation' fails because NetHack uses the You_feel function for those messages. Sometimes, the use of printf-style formatting also impedes your search. For example, suppose that you get the message "You feel that eating the little dog was a bad idea.". You grep for it but get no results: $ grep -n 'eating the little dog' */*.{c,h} $ You suspect that the monster is variable. You try again, searching for "bad idea" somewhere in the same line after "eating": $ grep -n 'eating.*bad idea' */*.{c,h} src/eat.c:486: You_feel("that eating the %s was a bad idea.", mons[pm].mname); $ A look around eat.c#line486 (in vanilla 3.4.3) shows the following: switch(pm) { case PM_LITTLE_DOG: case PM_DOG: case PM_LARGE_DOG: case PM_KITTEN: case PM_HOUSECAT: case PM_LARGE_CAT: if (!CANNIBAL_ALLOWED()) { You_feel("that eating the %s was a bad idea.", mons[pm].mname); HAggravate_monster |= FROMOUTSIDE; } break; From this, you guess that message means that you now have the intrinsic of aggravate monster, and that eating a little dog, dog, large dog, kitten, housecat, or large cat causes it. If you need to find in what file a certain function is defined, you can grep for the function name, prefixed with a caret, for example: $ grep ^delobj *.c invent.c:delobj(obj) $
  • Grep – polecenie występujące w Unixie i systemach pochodnych, które z danego tekstu pokazuje jedynie linie, które pasują do wzorca