"MAWK
=== MAWK Help ==================
-- String Commands -------------
(alphabetically)
ADJ adjust
 adj s left or rite (n<0) in n*t
 s t n -> s'
CPR compress
 compress s wrt to char c
 s c -> s'
CRY crypt
 xor-crypt s w/ real passnum>0
 s pn -> s'
CTS center_in_strings
 center s in n*t
 s t n -> s'
DEL delete
 delete s[n1..n2] from s
 s n1 n2 -> t
DNC downcase
 downcase all latin chars in s
 s -> s'
FMB from_binary
 bytes 0..9, 10..35 ->
  chars 0..9, A..Z
 s -> s'
INS insert
 insert t starting at s[n]
 s t n -> s'
L2S list_to_string
 convert list of bytes to string
 { b1 b2 b3 ... bn }
   -> b1b2b3...bn
LRS left_or_right_string
 left or rite (n<0) n chars of s
 s n -> s'
LUT lookup_table
 s[i] found at t[j] repl by r[j]
 t r s -> t r s'
MAP map
 s[i] repl by t[s[i]]
 t s -> t s'
MKS make_string
 chars c1..c2 continuously
 c1 c2 -> c1...c2
MNL merge_newlines
 merge strings with newlines
 { s1 s2 s3 ... sn }
   -> s1\ns2\n...sn
NPS nth_position
 find f in s starting at abs(n)
  n<0: search backwards
 s f n -> p
NST ntimes_string
 repeat s n times
 s n -> s'
OVL overlay
 overlay s with t, starting at
  s[n]. s' same len as s.
 s t n -> s'
OVR overwrite
 overwrite s w/ t, starting at
  s[n]. s' may be longer than s.
 s t n -> s'
POX pos_with_extensions
 searches s for regex p
 s p -> start matchlen|0
 regex metachars:
  ?         any char
  *         any string
  [abd-f]   inclusive range
  [~abd-f]  exclusive range
  (..)      term

  @         zero or more
  +         one or more
  occurrences of the preceding
  char/range/term
 Metachars are not special in []
POY pos_with_more_extensions
 searches s for regex p
 s p -> start matchlen|0
 recognizes beyond POX:
  <         begin of string
  >         end of string
POZ pos_w_even_more_extensions
 searches s for regex p
 s p -> start matchlen|0
 recognizes beyond POY:
  |         logical OR (chr 124)
  (a toplevel separator)
RCT regex_substr_count
 counts regex p in s
 s p -> n
REV reverse
 reverse order of chars in s
 s -> s'
RFM reformat_paragraph
 reformat s to wid, lmar string
  slmar, indents 1st line to ind
 s ind slmar wid -> s'
 ind may be negative
ROZ replace_with_all_extensions
 replace regex p in s by r,
  n = #replacements
 s p r -> s' n
RPC replace
 replace p in s by r,
  n = #replacements
 s p r -> s' n
S2L string_to_list
 split s into bytes
 s -> { b1 b2 b3 ... }
SCC string_char_code
 ascii code of n'th char in s
 s n -> c
SCT substring_count
 counts p in s
 s p -> n
SEN string_end
 endstring of s: s[n..size(s)]
 s n -> s'
SMN string_minimum
 minimum char in a string
 s -> cmin
SMX string_maximum
 maximum char in a string
 s -> cmax
SNL split_string_at_newlines
 split s into lines
 s -> { s1 s2 s3 ... }
SPL string_plot
 plots (i, sy[i] div 4)
 sy -> (graph grob modified)
SRT stringsort
 ascending sort of chars
 s -> s'
SWC string_write_char_code
 replace s[n] by char(c)
 s n c -> s'
SXY string_x_y_plot
 plots (sx[i], sy[i])
 sx sy -> (graph grob modified)
 xlims 0..63, ylims 0..130
TOB to_binary
 chars 0..9, A..Z ->
  bytes 0..9, 10..35
 s -> s'
TRL trim_left
 remove all left chars c in s
 s c -> s'
TRM trim_string
 remove all left and rite c
 s c -> s'
TRR trim_right
 remove all rite chars c in s
 s c -> s'
UNT untab
 chars < 31 replaced by a spc,
  except 10. 13 replaced by 10.
 s -> s'
UNW unwrap
 chars 10 and 13 replaced by spc
 s -> s'
UPC upcase
 upcases all latin chars
 s -> s'
WCT word_count
 #words in s, separator char c
 s c -> n
WDX word_indexes
 indices of n'th word, sep c
 s c n -> s i1 i2
 i1 = i2 = 0 for fail
WEX word_extract
 n'th word in s, sep char c
 s c n -> w
WIN word_insert
 inserts t before n'th word in
  s, sep char c
 s t c n -> s'
 appends ct if n too big
 prepends for n<=0
WRP word_wrap
 reformats s to wid, returns
  formatted s1, remainder s2
 s wid -> s1 s2
WST word_set
 sets n'th word to t in s,
  sep char c
 s t c n -> s'
 appends ct if n too big
 prepends for n<=0

-- Sets ------------------------
== Definition ==
A set variable z consists of
32 bytes = 256 bits, each bit
representing absence or presence
of one of the possibly 256
members of a set.

== Commands ==
Z01 set_init_to_all_0_or_1
 set z created w/ to all 0 or 1
 0/1 -> z
S2Z string_to_set
 set of the chars of s
 s -> z
Z2S set_to_string
 s has all chars in set
 z -> s
ZIN string_in_set?
 all chars of s in z?
 z s -> 0/1
ZSU set_subset?
 z2 a subset of z1?
 z1 z2 -> 0/1

== More Set Ops ==
Use math/base/logic cmds for:
complement  : NOT z
unification : z1 OR z2
intersection: z1 AND z2
difference  : z1 XOR z2
z1 w/o z2   : z1 AND (NOT z2)

Number of members of a set:
 SIZE(Z2S(z))
================================
"
