put square brackets around all file names (/usr/bin => [/usr/bin], etc.)
put "ctl-" in front of all control characters
delete all characters except lower-case letters
put square brackets around all words of the form "b" + 0 or more letters + a digit
(b3=>[b3], bit9 => [bit9], etc.)
add an exclamation point after all 4-letter words
Escape Sequences
Write Gema rules to
replace "Now" with "Then", but only at the beginning of a line
put "Top" and "Bottom" at the beginning and end of a file, respectively
replace all tab characters with three spaces
replace "John Thomas" with "joHn tHomas", ignoring capitalization in the input
replace "the" with "this", but only when "the" is a whole word
delete Ada-style comments ("--" and everything after it on the same line)
print all strings in the input that begin with "p" (given "pepper plants",
print "pepper plants", "pper plants", "per plants", and "plants")
put "s" after all words that are followed by white space
Functions
Write Gema rules to
add 100 to every number
count the number of words in the input file
print every word by itself centered on a 50-character line
replace all occurrences of "char" plus a number with the corresponding
character ("char13" => a carriage return, etc.)
replace all numbers greater than "100" with "BIG NUMBER"
replace all words greater than "spoon" with "ZOOM" (ignoring capitalization)
at the top of the file, print "Date" and the current date and time
in international standard form (yyyy-mm-dd hh:mm:ss)
replace all x,y number pairs with 10*x - y/3
replace all identifiers with their lower-case equivalents (HotJava => hotjava, etc.)
capitalize all words (the => The, etc.)
print all lines that contain the word "zebra", along with the file name
and the line number in the format "F <filename>, L <linenumber>"
replace all printing characters with their numeric value
replace all hex numbers of the form 0xDDDD with their decimal equivalents
print all lines that are palindromes (i.e. are the same backwards and forwards)
format the input file 40 characters wide with "# " at the beginning of each line
print a list of all the words in the input file, with each of the words listed just once
Command-Line Arguments and Domains
Write Gema rules to
define a domain that deletes vowels and make it the default domain; then
define another domain that inherits from
the first, but in addition deletes consonants
accept a "-delete " command-line parameter, and delete the specified
word from the input file
define two domains, one named xyz that replaces "e" with "x", and one
named abc that replaces "a" with "y"; then define a command-line parameter
-domain which accepts the name of the domain to use on the input file