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