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