xref: /netbsd-src/games/quiz/datfiles/ed (revision 5bfb98b1c8808158bdecb27eb5157dd0b370dadc)
1*5bfb98b1Scgdprepare to add text at beginning of file:0a|1i
2*5bfb98b1Scgdfind name of file being edited:f
3*5bfb98b1Scgdprint last 3 lines of file:$-[2|-],$p
4*5bfb98b1Scgdprint previous line:[-|^]{p}|{.}-{1}{p}
5*5bfb98b1Scgdprint whole file:1,$p|g/[^|$]/p
6*5bfb98b1Scgddelete this line and next:.{,|;}[{.}+{1}|.1]d
7*5bfb98b1Scgdprepare to replace text from here to just before next "PP":\
8*5bfb98b1Scgd.{,|;}/[PP|{^}\\.PP]/-{1}c
9*5bfb98b1Scgdfind next "1.2":/1\\.2/{p}
10*5bfb98b1Scgdfind next 2-or-more digit number:\
11*5bfb98b1Scgd/\[[0|1]-9\]\[0-9\]/{p}
12*5bfb98b1Scgdmove rest of this paragraph (separated by "PP") to end of previous one:\
13*5bfb98b1Scgd[.,|{.}+{1},|.1,]/[PP|{^}\\.PP]/-{1}m[??|?{^}{\\.}PP?]-{1}
14*5bfb98b1Scgdprint every "Oxygen" or "oxygen":[g|1,$g]/\[[Oo|oO]\]xygen/[p|.p]
15*5bfb98b1Scgdchange each "BTL" in file to "Bell Laboratories" and check:\
16*5bfb98b1Scgd[g|1,$g]/BTL/[s|.s]/[/|BTL/]Bell Laboratories/gp
17*5bfb98b1Scgdcombine every even-numbered line with the next odd-numbered line:\
18*5bfb98b1Scgd2,${-{1}}g/[^|$]/[j|.,{.}+{1}j|.,.1j]
19*5bfb98b1Scgdprint next "SH" and following line:\
20*5bfb98b1Scgd/SH/;[{.}+{1}|.1]p|/SH/,[//|/SH/][{.}+{1}|.1]p
21*5bfb98b1Scgdprint from next "TS" to following "TE":/TS/;/TE/p
22*5bfb98b1Scgdreverse order of lines in whole file:[g|1,$g]/^/[m|.m]0
23*5bfb98b1Scgdreplace each string of x's in current line by one x:\
24*5bfb98b1Scgd[s|.s]/[x|\[x\]][x|\[x\]]*/x/g{p}{  (not s/x*/x/g)}
25*5bfb98b1Scgdchange first "hte" in current line to "the" and check:[s|.s]/hte/the/p
26*5bfb98b1Scgdcombine previous line and this one:\
27*5bfb98b1Scgd[-,|^,|{.}-{1},].j
28*5bfb98b1Scgdgo to line after third "PP" ahead:\
29*5bfb98b1Scgd/[PP|{^}\\.PP]/;[//|/[PP|{^}\\.PP]/];[//|/[PP|{^}\\.PP]/]\
30*5bfb98b1Scgd[{+}1|+]|;[{.}+{1}|.1]{  (not ...p)}
31*5bfb98b1Scgdexchange current line with previous line:\
32*5bfb98b1Scgd[[-|^]m|{.}-{1}m].|{.}m[[--|^^]|{.}-2]
33*5bfb98b1Scgdmove everything from here through "stop." to end of file:\
34*5bfb98b1Scgd.,/stop\\./m$
35*5bfb98b1Scgdcurrent line has 2 fields separated by 1 blank; exchange them:\
36*5bfb98b1Scgd[s|.s]/[\\|^\\]([.|\[^ \]]*\\) \\([.|\[^ \]]*\\)[/|$/]\\2 \\1/{p}
37*5bfb98b1Scgdinsert a "0" after last "0" on current line:\
38*5bfb98b1Scgd[s|.s]/[.*0/&0|^.*0/&0|0\\(\[^0\]*\\)$/[0&|00\1]|0\[^0\]*$/0&\
39*5bfb98b1Scgd|\[^0\]*$/0&]/{p}
40*5bfb98b1Scgdreplace "a*b" by "a**b":s/[a\\*b|a[*]b]/a**b/{p}|\
41*5bfb98b1Scgds/\\*/**/p
42*5bfb98b1Scgdattach the word "extra" to the end of the current line:\
43*5bfb98b1Scgd[s|.s]/$/{ }extra/{p}
44*5bfb98b1Scgdreplace "ATT" in current line by "AT&T":\
45*5bfb98b1Scgd[s|.s]/ATT/AT\\&T/{g}{p}
46*5bfb98b1Scgddouble the length of the current line by repetition:\
47*5bfb98b1Scgd[s|.s]/[.*|.|^.*$]/&&/{p}
48*5bfb98b1Scgdlook for another line containing what you just looked for://
49*5bfb98b1Scgdfind the previous line that contains a capital letter:?\[A-Z\]?{p}
50*5bfb98b1Scgddelete the next line that contains only capital letters:\
51*5bfb98b1Scgd/^\[A-Z\]*$/d|/^\[A-Z\]\[A-Z\]*$/d
52*5bfb98b1Scgdplace a copy of current line at the end of the file:\
53*5bfb98b1Scgdt$|.{,.}t$
54*5bfb98b1Scgdfind how many lines there are:=|$=
55*5bfb98b1Scgdfind the number of the current line:.=
56*5bfb98b1Scgddelete the first 3 lines of the file:1,3d
57*5bfb98b1Scgddelete every line that doesn't begin with "A":\
58*5bfb98b1Scgd[v|1,$v]/^A/d{  (not g/^\[^A\]/d)}
59*5bfb98b1Scgddelete every empty line from here through next "LP":\
60*5bfb98b1Scgd.,/[LP|{{^}\\.}LP]/g/^$/d
61*5bfb98b1Scgdprint the line after each "AU":\
62*5bfb98b1Scgd[g|1,$g]/[AU|{^}\\.AU]/[{.}+{1}|.1]{p}
63*5bfb98b1Scgddelete everything after "proud" from current line:\
64*5bfb98b1Scgd[s|.s]/proud.*/proud/{p}
65*5bfb98b1Scgddelete part of current line from "alpha" through "omega":\
66*5bfb98b1Scgd[s|.s]/alpha.*omega//{p}
67*5bfb98b1Scgdsave everything up through current line in file "prefix":1,.w prefix
68*5bfb98b1Scgdprepare to add text at end of file:$a
69*5bfb98b1Scgdappend the contents of file "suffix" to this file:$r suffix
70*5bfb98b1Scgdgo back 10 lines:{.}-10{p}|----------
71*5bfb98b1Scgdchange every "01" in current line to "1":[s|.s]/01/1/g{p}
72*5bfb98b1Scgdgo to next line that contains a double capital letter:\
73*5bfb98b1Scgd/\\(\[A-Z\]\\)\\1/{p}
74*5bfb98b1Scgdplace parens () around current line:\
75*5bfb98b1Scgd[s|.s]/[.*|^.*$]/(&)/{p}
76*5bfb98b1Scgdthe current line is too long for your terminal; print it to fit:\
77*5bfb98b1Scgdl|.l
78*5bfb98b1Scgdput the work you've done back in the original file:w
79*5bfb98b1Scgdappend the whole file to the file "unfinished":\
80*5bfb98b1Scgd[W|1,$W] unfinished
81*5bfb98b1Scgdinsert "\\&" at beginning of current line:\
82*5bfb98b1Scgd[s|.s]/^/\\\\\\&/{p}
83*5bfb98b1Scgdlist your current directory:!ls
84*5bfb98b1Scgdstop work on current file and shift to file "other":e other
85