docs

docs and guides
git clone git://git.2f30.org/docs
Log | Files | Refs

edcheat.ps (42467B)


      1 %!PS-Adobe-3.0
      2 %%BoundingBox: 24 24 571 818
      3 %%Title: Enscript Output
      4 %%For: Lazaros Koromilas,,,
      5 %%Creator: GNU Enscript 1.6.5.2
      6 %%CreationDate: Wed Sep 19 15:50:37 2012
      7 %%Orientation: Portrait
      8 %%Pages: (atend)
      9 %%DocumentMedia: A4 595 842 0 () ()
     10 %%DocumentNeededResources: (atend)
     11 %%LanguageLevel: 2
     12 %%EndComments
     13 %%BeginProlog
     14 %%BeginResource: procset Enscript-Prolog 1.6.5 2
     15 %
     16 % Procedures.
     17 %
     18 
     19 /_S {	% save current state
     20   /_s save def
     21 } def
     22 /_R {	% restore from saved state
     23   _s restore
     24 } def
     25 
     26 /S {	% showpage protecting gstate
     27   gsave
     28   showpage
     29   grestore
     30 } bind def
     31 
     32 /MF {	% fontname newfontname -> -	make a new encoded font
     33   /newfontname exch def
     34   /fontname exch def
     35 
     36   /fontdict fontname findfont def
     37   /newfont fontdict maxlength dict def
     38 
     39   fontdict {
     40     exch
     41     dup /FID eq {
     42       % skip FID pair
     43       pop pop
     44     } {
     45       % copy to the new font dictionary
     46       exch newfont 3 1 roll put
     47     } ifelse
     48   } forall
     49 
     50   newfont /FontName newfontname put
     51 
     52   % insert only valid encoding vectors
     53   encoding_vector length 256 eq {
     54     newfont /Encoding encoding_vector put
     55   } if
     56 
     57   newfontname newfont definefont pop
     58 } def
     59 
     60 /MF_PS { % fontname newfontname -> -	make a new font preserving its enc
     61   /newfontname exch def
     62   /fontname exch def
     63 
     64   /fontdict fontname findfont def
     65   /newfont fontdict maxlength dict def
     66 
     67   fontdict {
     68     exch
     69     dup /FID eq {
     70       % skip FID pair
     71       pop pop
     72     } {
     73       % copy to the new font dictionary
     74       exch newfont 3 1 roll put
     75     } ifelse
     76   } forall
     77 
     78   newfont /FontName newfontname put
     79 
     80   newfontname newfont definefont pop
     81 } def
     82 
     83 /SF { % fontname width height -> -	set a new font
     84   /height exch def
     85   /width exch def
     86 
     87   findfont
     88   [width 0 0 height 0 0] makefont setfont
     89 } def
     90 
     91 /SUF { % fontname width height -> -	set a new user font
     92   /height exch def
     93   /width exch def
     94 
     95   /F-gs-user-font MF
     96   /F-gs-user-font width height SF
     97 } def
     98 
     99 /SUF_PS { % fontname width height -> -	set a new user font preserving its enc
    100   /height exch def
    101   /width exch def
    102 
    103   /F-gs-user-font MF_PS
    104   /F-gs-user-font width height SF
    105 } def
    106 
    107 /M {moveto} bind def
    108 /s {show} bind def
    109 
    110 /Box {	% x y w h -> -			define box path
    111   /d_h exch def /d_w exch def /d_y exch def /d_x exch def
    112   d_x d_y  moveto
    113   d_w 0 rlineto
    114   0 d_h rlineto
    115   d_w neg 0 rlineto
    116   closepath
    117 } def
    118 
    119 /bgs {	% x y height blskip gray str -> -	show string with bg color
    120   /str exch def
    121   /gray exch def
    122   /blskip exch def
    123   /height exch def
    124   /y exch def
    125   /x exch def
    126 
    127   gsave
    128     x y blskip sub str stringwidth pop height Box
    129     gray setgray
    130     fill
    131   grestore
    132   x y M str s
    133 } def
    134 
    135 /bgcs { % x y height blskip red green blue str -> -  show string with bg color
    136   /str exch def
    137   /blue exch def
    138   /green exch def
    139   /red exch def
    140   /blskip exch def
    141   /height exch def
    142   /y exch def
    143   /x exch def
    144 
    145   gsave
    146     x y blskip sub str stringwidth pop height Box
    147     red green blue setrgbcolor
    148     fill
    149   grestore
    150   x y M str s
    151 } def
    152 
    153 % Highlight bars.
    154 /highlight_bars {	% nlines lineheight output_y_margin gray -> -
    155   gsave
    156     setgray
    157     /ymarg exch def
    158     /lineheight exch def
    159     /nlines exch def
    160 
    161     % This 2 is just a magic number to sync highlight lines to text.
    162     0 d_header_y ymarg sub 2 sub translate
    163 
    164     /cw d_output_w cols div def
    165     /nrows d_output_h ymarg 2 mul sub lineheight div cvi def
    166 
    167     % for each column
    168     0 1 cols 1 sub {
    169       cw mul /xp exch def
    170 
    171       % for each rows
    172       0 1 nrows 1 sub {
    173         /rn exch def
    174         rn lineheight mul neg /yp exch def
    175         rn nlines idiv 2 mod 0 eq {
    176 	  % Draw highlight bar.  4 is just a magic indentation.
    177 	  xp 4 add yp cw 8 sub lineheight neg Box fill
    178 	} if
    179       } for
    180     } for
    181 
    182   grestore
    183 } def
    184 
    185 % Line highlight bar.
    186 /line_highlight {	% x y width height gray -> -
    187   gsave
    188     /gray exch def
    189     Box gray setgray fill
    190   grestore
    191 } def
    192 
    193 % Column separator lines.
    194 /column_lines {
    195   gsave
    196     .1 setlinewidth
    197     0 d_footer_h translate
    198     /cw d_output_w cols div def
    199     1 1 cols 1 sub {
    200       cw mul 0 moveto
    201       0 d_output_h rlineto stroke
    202     } for
    203   grestore
    204 } def
    205 
    206 % Column borders.
    207 /column_borders {
    208   gsave
    209     .1 setlinewidth
    210     0 d_footer_h moveto
    211     0 d_output_h rlineto
    212     d_output_w 0 rlineto
    213     0 d_output_h neg rlineto
    214     closepath stroke
    215   grestore
    216 } def
    217 
    218 % Do the actual underlay drawing
    219 /draw_underlay {
    220   ul_style 0 eq {
    221     ul_str true charpath stroke
    222   } {
    223     ul_str show
    224   } ifelse
    225 } def
    226 
    227 % Underlay
    228 /underlay {	% - -> -
    229   gsave
    230     0 d_page_h translate
    231     d_page_h neg d_page_w atan rotate
    232 
    233     ul_gray setgray
    234     ul_font setfont
    235     /dw d_page_h dup mul d_page_w dup mul add sqrt def
    236     ul_str stringwidth pop dw exch sub 2 div ul_h_ptsize -2 div moveto
    237     draw_underlay
    238   grestore
    239 } def
    240 
    241 /user_underlay {	% - -> -
    242   gsave
    243     ul_x ul_y translate
    244     ul_angle rotate
    245     ul_gray setgray
    246     ul_font setfont
    247     0 0 ul_h_ptsize 2 div sub moveto
    248     draw_underlay
    249   grestore
    250 } def
    251 
    252 % Page prefeed
    253 /page_prefeed {		% bool -> -
    254   statusdict /prefeed known {
    255     statusdict exch /prefeed exch put
    256   } {
    257     pop
    258   } ifelse
    259 } def
    260 
    261 % Wrapped line markers
    262 /wrapped_line_mark {	% x y charwith charheight type -> -
    263   /type exch def
    264   /h exch def
    265   /w exch def
    266   /y exch def
    267   /x exch def
    268 
    269   type 2 eq {
    270     % Black boxes (like TeX does)
    271     gsave
    272       0 setlinewidth
    273       x w 4 div add y M
    274       0 h rlineto w 2 div 0 rlineto 0 h neg rlineto
    275       closepath fill
    276     grestore
    277   } {
    278     type 3 eq {
    279       % Small arrows
    280       gsave
    281         .2 setlinewidth
    282         x w 2 div add y h 2 div add M
    283         w 4 div 0 rlineto
    284         x w 4 div add y lineto stroke
    285 
    286         x w 4 div add w 8 div add y h 4 div add M
    287         x w 4 div add y lineto
    288 	w 4 div h 8 div rlineto stroke
    289       grestore
    290     } {
    291       % do nothing
    292     } ifelse
    293   } ifelse
    294 } def
    295 
    296 % EPSF import.
    297 
    298 /BeginEPSF {
    299   /b4_Inc_state save def    		% Save state for cleanup
    300   /dict_count countdictstack def	% Count objects on dict stack
    301   /op_count count 1 sub def		% Count objects on operand stack
    302   userdict begin
    303   /showpage { } def
    304   0 setgray 0 setlinecap
    305   1 setlinewidth 0 setlinejoin
    306   10 setmiterlimit [ ] 0 setdash newpath
    307   /languagelevel where {
    308     pop languagelevel
    309     1 ne {
    310       false setstrokeadjust false setoverprint
    311     } if
    312   } if
    313 } bind def
    314 
    315 /EndEPSF {
    316   count op_count sub { pos } repeat	% Clean up stacks
    317   countdictstack dict_count sub { end } repeat
    318   b4_Inc_state restore
    319 } bind def
    320 
    321 % Check PostScript language level.
    322 /languagelevel where {
    323   pop /gs_languagelevel languagelevel def
    324 } {
    325   /gs_languagelevel 1 def
    326 } ifelse
    327 %%EndResource
    328 %%BeginResource: procset Enscript-Encoding-88591 1.6.5 2
    329 /encoding_vector [
    330 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    331 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    332 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    333 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    334 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    335 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    336 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    337 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    338 /space        	/exclam       	/quotedbl     	/numbersign   	
    339 /dollar       	/percent      	/ampersand    	/quoteright   	
    340 /parenleft    	/parenright   	/asterisk     	/plus         	
    341 /comma        	/hyphen       	/period       	/slash        	
    342 /zero         	/one          	/two          	/three        	
    343 /four         	/five         	/six          	/seven        	
    344 /eight        	/nine         	/colon        	/semicolon    	
    345 /less         	/equal        	/greater      	/question     	
    346 /at           	/A            	/B            	/C            	
    347 /D            	/E            	/F            	/G            	
    348 /H            	/I            	/J            	/K            	
    349 /L            	/M            	/N            	/O            	
    350 /P            	/Q            	/R            	/S            	
    351 /T            	/U            	/V            	/W            	
    352 /X            	/Y            	/Z            	/bracketleft  	
    353 /backslash    	/bracketright 	/asciicircum  	/underscore   	
    354 /quoteleft    	/a            	/b            	/c            	
    355 /d            	/e            	/f            	/g            	
    356 /h            	/i            	/j            	/k            	
    357 /l            	/m            	/n            	/o            	
    358 /p            	/q            	/r            	/s            	
    359 /t            	/u            	/v            	/w            	
    360 /x            	/y            	/z            	/braceleft    	
    361 /bar          	/braceright   	/tilde        	/.notdef      	
    362 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    363 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    364 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    365 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    366 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    367 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    368 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    369 /.notdef      	/.notdef      	/.notdef      	/.notdef      	
    370 /space        	/exclamdown   	/cent         	/sterling     	
    371 /currency     	/yen          	/brokenbar    	/section      	
    372 /dieresis     	/copyright    	/ordfeminine  	/guillemotleft	
    373 /logicalnot   	/hyphen       	/registered   	/macron       	
    374 /degree       	/plusminus    	/twosuperior  	/threesuperior	
    375 /acute        	/mu           	/paragraph    	/bullet       	
    376 /cedilla      	/onesuperior  	/ordmasculine 	/guillemotright	
    377 /onequarter   	/onehalf      	/threequarters	/questiondown 	
    378 /Agrave       	/Aacute       	/Acircumflex  	/Atilde       	
    379 /Adieresis    	/Aring        	/AE           	/Ccedilla     	
    380 /Egrave       	/Eacute       	/Ecircumflex  	/Edieresis    	
    381 /Igrave       	/Iacute       	/Icircumflex  	/Idieresis    	
    382 /Eth          	/Ntilde       	/Ograve       	/Oacute       	
    383 /Ocircumflex  	/Otilde       	/Odieresis    	/multiply     	
    384 /Oslash       	/Ugrave       	/Uacute       	/Ucircumflex  	
    385 /Udieresis    	/Yacute       	/Thorn        	/germandbls   	
    386 /agrave       	/aacute       	/acircumflex  	/atilde       	
    387 /adieresis    	/aring        	/ae           	/ccedilla     	
    388 /egrave       	/eacute       	/ecircumflex  	/edieresis    	
    389 /igrave       	/iacute       	/icircumflex  	/idieresis    	
    390 /eth          	/ntilde       	/ograve       	/oacute       	
    391 /ocircumflex  	/otilde       	/odieresis    	/divide       	
    392 /oslash       	/ugrave       	/uacute       	/ucircumflex  	
    393 /udieresis    	/yacute       	/thorn        	/ydieresis    	
    394 ] def
    395 %%EndResource
    396 %%EndProlog
    397 %%BeginSetup
    398 %%IncludeResource: font Courier-Bold
    399 %%IncludeResource: font DejaVuSansMono
    400 /HFpt_w 10 def
    401 /HFpt_h 10 def
    402 /Courier-Bold /HF-gs-font MF
    403 /HF /HF-gs-font findfont [HFpt_w 0 0 HFpt_h 0 0] makefont def
    404 /DejaVuSansMono /F-gs-font MF
    405 /F-gs-font 6 6 SF
    406 /#copies 1 def
    407 % Pagedevice definitions:
    408 gs_languagelevel 1 gt {
    409   <<
    410     /Duplex true /PageSize [595 842] 
    411   >> setpagedevice
    412 } if
    413 /d_page_w 547 def
    414 /d_page_h 794 def
    415 /d_header_x 0 def
    416 /d_header_y 794 def
    417 /d_header_w 547 def
    418 /d_header_h 0 def
    419 /d_footer_x 0 def
    420 /d_footer_y 0 def
    421 /d_footer_w 547 def
    422 /d_footer_h 0 def
    423 /d_output_w 547 def
    424 /d_output_h 794 def
    425 /cols 2 def
    426 %%EndSetup
    427 %%Page: (1) 1
    428 %%BeginPageSetup
    429 _S
    430 24 24 translate
    431 /pagenum 1 def
    432 /fname () def
    433 /fdir (.) def
    434 /ftail (.) def
    435 /user_header_p false def
    436 /user_footer_p false def
    437 %%EndPageSetup
    438 5 785 M
    439 (.---------------------------------------------------------------------.) s
    440 5 778 M
    441 (|                                                                     |) s
    442 5 771 M
    443 (|                      The Original UNIX Text Editor                  |) s
    444 5 764 M
    445 (|                             Ed Cheat Sheet                          |) s
    446 5 757 M
    447 (|                                                                     |) s
    448 5 750 M
    449 ('---------------------------------------------------------------------') s
    450 5 743 M
    451 (| Peteris Krumins \(peter@catonmat.net\), 2007.08.22                    |) s
    452 5 736 M
    453 (| http://www.catonmat.net  -  good coders code, great reuse           |) s
    454 5 729 M
    455 ('---------------------------------------------------------------------') s
    456 5 715 M
    457 ( ====================== Line Addressing Summary ======================) s
    458 5 701 M
    459 (.----------------.----------------------------------------------------.) s
    460 5 694 M
    461 (|                |                                                    |) s
    462 5 687 M
    463 (| Address Symbol | Description                                        |) s
    464 5 680 M
    465 (|                |                                                    |) s
    466 5 673 M
    467 ('----------------+----------------------------------------------------') s
    468 5 666 M
    469 (| .              | The current line \(address\) in the buffer.          |) s
    470 5 659 M
    471 ('----------------+----------------------------------------------------') s
    472 5 652 M
    473 (| $              | The last line in the buffer.                       |) s
    474 5 645 M
    475 ('----------------+----------------------------------------------------') s
    476 5 638 M
    477 (| n              | The nth, line in the buffer where n is a number    |) s
    478 5 631 M
    479 (|                | in the range [0,$].                                |) s
    480 5 624 M
    481 ('----------------+----------------------------------------------------') s
    482 5 617 M
    483 (| $              | The last line in the buffer.                       |) s
    484 5 610 M
    485 ('----------------+----------------------------------------------------') s
    486 5 603 M
    487 (| -              | The previous line. This is equivalent to -1 and    |) s
    488 5 596 M
    489 (| ^              | may be repeated with cumulative effect.            |) s
    490 5 589 M
    491 ('----------------+----------------------------------------------------') s
    492 5 582 M
    493 (| -n             | The nth previous line, where n is a non-negative   |) s
    494 5 575 M
    495 (| ^n             | number.                                            |) s
    496 5 568 M
    497 ('----------------+----------------------------------------------------') s
    498 5 561 M
    499 (| +              | The next line. This is equivalent to +1 and may    |) s
    500 5 554 M
    501 (|                | be repeated with cumulative effect.                |) s
    502 5 547 M
    503 ('----------------+----------------------------------------------------') s
    504 5 540 M
    505 (| +n             | The nth next line, where n is a non-negative       |) s
    506 5 533 M
    507 (| whitespace n   | number.                                            |) s
    508 5 526 M
    509 (|                | Whitespace followed by a number n is interpreted   |) s
    510 5 519 M
    511 (|                | as +n.                                             |) s
    512 5 512 M
    513 ('----------------+----------------------------------------------------') s
    514 5 505 M
    515 (| ,              | The first through last lines in the buffer.        |) s
    516 5 498 M
    517 (| %              | This is equivalent to the address range 1,$.       |) s
    518 5 491 M
    519 ('----------------+----------------------------------------------------') s
    520 5 484 M
    521 (| ;              | The current through last lines in the buffer.      |) s
    522 5 477 M
    523 (|                | This is equivalent to the address range .,$.       |) s
    524 5 470 M
    525 ('----------------+----------------------------------------------------') s
    526 5 463 M
    527 (| /re/           | The next line containing the regular               |) s
    528 5 456 M
    529 (|                | expression re.                                     |) s
    530 5 449 M
    531 (|                | The search wraps to the beginning of the buffer    |) s
    532 5 442 M
    533 (|                | and continues down to the current line, if         |) s
    534 5 435 M
    535 (|                | necessary.                                         |) s
    536 5 428 M
    537 (|                | // repeats the last search.                        |) s
    538 5 421 M
    539 ('----------------+----------------------------------------------------') s
    540 5 414 M
    541 (| ?re?           | The previous line containing the regular           |) s
    542 5 407 M
    543 (|                | expression re.                                     |) s
    544 5 400 M
    545 (|                | The search wraps to the end of the buffer and      |) s
    546 5 393 M
    547 (|                | continues up to the current line, if necessary.    |) s
    548 5 386 M
    549 (|                | ?? repeats the last search.                        |) s
    550 5 379 M
    551 ('----------------+----------------------------------------------------') s
    552 5 372 M
    553 (| 'lc            | The line previously marked by a `k' \(mark\)         |) s
    554 5 365 M
    555 (|                | command, where lc is a lower case letter.          |) s
    556 5 358 M
    557 ('----------------'----------------------------------------------------') s
    558 5 344 M
    559 (Each address in a comma-delimited range is interpreted relative) s
    560 5 337 M
    561 (to the current address.) s
    562 5 330 M
    563 (In a semicolon-delimited range, the 1st address is used to set) s
    564 5 323 M
    565 (the current address, and the 2nd address is interpreted) s
    566 5 316 M
    567 (relative to the first.) s
    568 5 295 M
    569 ( ========================== Command Summary ==========================) s
    570 5 281 M
    571 (.-------------------------.-------------------------------------------.) s
    572 5 274 M
    573 (|                         |                                           |) s
    574 5 267 M
    575 (| Command                 | Description                               |) s
    576 5 260 M
    577 (|                         |                                           |) s
    578 5 253 M
    579 ('-------------------------+-------------------------------------------') s
    580 5 246 M
    581 (| \(.\)a                    | Appends text to the buffer after the      |) s
    582 5 239 M
    583 (|                         | addressed line, which may be theaddress   |) s
    584 5 232 M
    585 (|                         | 0 \(zero\). Text is entered in input mode.  |) s
    586 5 225 M
    587 (|                         | The current address is set to last line   |) s
    588 5 218 M
    589 (|                         | entered.                                  |) s
    590 5 211 M
    591 ('-------------------------+-------------------------------------------') s
    592 5 204 M
    593 (| \(.,.\)c                  | Changes lines in the buffer. The          |) s
    594 5 197 M
    595 (|                         | addressed lines are deleted from the      |) s
    596 5 190 M
    597 (|                         | buffer, and text is appended in their     |) s
    598 5 183 M
    599 (|                         | place.                                    |) s
    600 5 176 M
    601 (|                         | Text is entered in input mode. The        |) s
    602 5 169 M
    603 (|                         | current address is set to last line       |) s
    604 5 162 M
    605 (|                         | entered.                                  |) s
    606 5 155 M
    607 ('-------------------------+-------------------------------------------') s
    608 5 148 M
    609 (| \(.,.\)d                  | Deletes the addressed lines from the      |) s
    610 5 141 M
    611 (|                         | buffer. If there is a line after the      |) s
    612 5 134 M
    613 (|                         | deleted range, then the current address   |) s
    614 5 127 M
    615 (|                         | is set to this line. Otherwise the        |) s
    616 5 120 M
    617 (|                         | current address is set to the line before |) s
    618 5 113 M
    619 (|                         | the deleted range.                        |) s
    620 5 106 M
    621 ('-------------------------+-------------------------------------------') s
    622 5 99 M
    623 (| e file                  | Edits file, and sets the default          |) s
    624 5 92 M
    625 (|                         | filename. If file is not specified, then  |) s
    626 5 85 M
    627 (|                         | the default filename is used. Any lines   |) s
    628 5 78 M
    629 (|                         | in the buffer are deleted before the new  |) s
    630 5 71 M
    631 (|                         | file is read.  The current address is set |) s
    632 5 64 M
    633 (|                         | to the last line read.                    |) s
    634 5 57 M
    635 ('-------------------------+-------------------------------------------') s
    636 5 50 M
    637 (| e !command              | Edits the standard output of  `!command', |) s
    638 5 43 M
    639 (|                         | \(see !command below\). The default         |) s
    640 5 36 M
    641 (|                         | filename is unchanged. Any lines in the   |) s
    642 5 29 M
    643 (|                         | buffer are deleted before the output of   |) s
    644 5 22 M
    645 (|                         | command is read. The current address is   |) s
    646 5 15 M
    647 (|                         | set to the last line read.                |) s
    648 5 8 M
    649 ('-------------------------+-------------------------------------------') s
    650 278.5 785 M
    651 (.-------------------------+-------------------------------------------.) s
    652 278.5 778 M
    653 (| E file                  | Edits file unconditionally. This is       |) s
    654 278.5 771 M
    655 (|                         | similar to the e command, except that     |) s
    656 278.5 764 M
    657 (|                         | unwritten changes are discarded without   |) s
    658 278.5 757 M
    659 (|                         | warning. The current address is set to    |) s
    660 278.5 750 M
    661 (|                         | the last line read.                       |) s
    662 278.5 743 M
    663 ('-------------------------+-------------------------------------------') s
    664 278.5 736 M
    665 (| f file                  | Sets the default filename to file. If     |) s
    666 278.5 729 M
    667 (|                         | file is not specified, then the default   |) s
    668 278.5 722 M
    669 (|                         | unescaped filename is printed.            |) s
    670 278.5 715 M
    671 ('-------------------------+-------------------------------------------') s
    672 278.5 708 M
    673 (| \(1,$\)g/re/command-list  | Applies command-list to each of the       |) s
    674 278.5 701 M
    675 (|                         | addressed lines matching a regular        |) s
    676 278.5 694 M
    677 (|                         | expression re. The current address is set |) s
    678 278.5 687 M
    679 (|                         | to the line currently matched before      |) s
    680 278.5 680 M
    681 (|                         | command-list is executed. At the end of   |) s
    682 278.5 673 M
    683 (|                         | the `g' command, the current address is   |) s
    684 278.5 666 M
    685 (|                         | set to the last line affected by          |) s
    686 278.5 659 M
    687 (|                         | command-list.                             |) s
    688 278.5 652 M
    689 (|                         |                                           |) s
    690 278.5 645 M
    691 (|                         | Each command in command-list must be on a |) s
    692 278.5 638 M
    693 (|                         | separate line, and every line except for  |) s
    694 278.5 631 M
    695 (|                         | the last must be terminated by a          |) s
    696 278.5 624 M
    697 (|                         | back-slash \(\\\). Any commands are allowed, |) s
    698 278.5 617 M
    699 (|                         | except for `g', `G', `v', and `V'.        |) s
    700 278.5 610 M
    701 (|                         | A newline alone in command-list is        |) s
    702 278.5 603 M
    703 (|                         | equivalent to a `p' command.              |) s
    704 278.5 596 M
    705 ('-------------------------+-------------------------------------------') s
    706 278.5 589 M
    707 (| \(1,$\)G/re/              | Interactively edits the addressed lines   |) s
    708 278.5 582 M
    709 (|                         | matching a regular expression re. For     |) s
    710 278.5 575 M
    711 (|                         | each matching line, the line is printed,  |) s
    712 278.5 568 M
    713 (|                         | the current address is set, and the user  |) s
    714 278.5 561 M
    715 (|                         | is prompted to enter a command-list.      |) s
    716 278.5 554 M
    717 (|                         | At the end of the `G' command, the        |) s
    718 278.5 547 M
    719 (|                         | current address is set to the last line   |) s
    720 278.5 540 M
    721 (|                         | affected by \(the last\) command-list.      |) s
    722 278.5 533 M
    723 (|                         |                                           |) s
    724 278.5 526 M
    725 (|                         | The format of command-list is the same as |) s
    726 278.5 519 M
    727 (|                         | that of the `g' command. A newline alone  |) s
    728 278.5 512 M
    729 (|                         | acts as a null command list. A single `&' |) s
    730 278.5 505 M
    731 (|                         | repeats the last non-null command list.   |) s
    732 278.5 498 M
    733 ('-------------------------+-------------------------------------------') s
    734 278.5 491 M
    735 (| H                       | Toggles the printing of error             |) s
    736 278.5 484 M
    737 (|                         | explanations. By default, explanations    |) s
    738 278.5 477 M
    739 (|                         | are not printed. It is recommended that   |) s
    740 278.5 470 M
    741 (|                         | ed scripts begin with this command to aid |) s
    742 278.5 463 M
    743 (|                         | in debugging.                             |) s
    744 278.5 456 M
    745 ('-------------------------+-------------------------------------------') s
    746 278.5 449 M
    747 (| h                       | Prints an explanation of the last error.  |) s
    748 278.5 442 M
    749 ('-------------------------+-------------------------------------------') s
    750 278.5 435 M
    751 (| \(.\)i                    | Inserts text in the buffer before the     |) s
    752 278.5 428 M
    753 (|                         | current line. Text is entered in input    |) s
    754 278.5 421 M
    755 (|                         | mode. The current address is set to the   |) s
    756 278.5 414 M
    757 (|                         | last line entered.                        |) s
    758 278.5 407 M
    759 ('-------------------------+-------------------------------------------') s
    760 278.5 400 M
    761 (| \(.,.+1\)j                | Joins the addressed lines. The addressed  |) s
    762 278.5 393 M
    763 (|                         | lines are deleted from the buffer and     |) s
    764 278.5 386 M
    765 (|                         | replaced by a single line containing      |) s
    766 278.5 379 M
    767 (|                         | their joined text. The current address is |) s
    768 278.5 372 M
    769 (|                         | set to the resultant line.                |) s
    770 278.5 365 M
    771 ('-------------------------+-------------------------------------------') s
    772 278.5 358 M
    773 (| \(.\)klc                  | Marks a line with a lower case letter lc. |) s
    774 278.5 351 M
    775 (|                         | The line can then be addressed as 'lc     |) s
    776 278.5 344 M
    777 (|                         | \(i.e., a single quote followed by lc\) in  |) s
    778 278.5 337 M
    779 (|                         | subsequent commands. The mark is not      |) s
    780 278.5 330 M
    781 (|                         | cleared until the line is deleted or      |) s
    782 278.5 323 M
    783 (|                         | otherwise modified.                       |) s
    784 278.5 316 M
    785 ('-------------------------+-------------------------------------------') s
    786 278.5 309 M
    787 (| \(.,.\)l                  | Prints the addressed lines unambiguously. |) s
    788 278.5 302 M
    789 (|                         | If invoked from a terminal, ed pauses at  |) s
    790 278.5 295 M
    791 (|                         | the end of each page until a newline is   |) s
    792 278.5 288 M
    793 (|                         | entered. The current address is set to    |) s
    794 278.5 281 M
    795 (|                         | the last line printed.                    |) s
    796 278.5 274 M
    797 ('-------------------------+-------------------------------------------') s
    798 278.5 267 M
    799 (| \(.,.\)m\(.\)               | Moves lines in the buffer. The addressed  |) s
    800 278.5 260 M
    801 (|                         | lines are moved to after the right-hand   |) s
    802 278.5 253 M
    803 (|                         | destination address, which may be the     |) s
    804 278.5 246 M
    805 (|                         | address 0 \(zero\). The current address is  |) s
    806 278.5 239 M
    807 (|                         | set to the last line moved.               |) s
    808 278.5 232 M
    809 ('-------------------------+-------------------------------------------') s
    810 278.5 225 M
    811 (| \(.,.\)n                  | Prints the addressed lines along with     |) s
    812 278.5 218 M
    813 (|                         | their line nums. The curr. addr is set to |) s
    814 278.5 211 M
    815 (|                         | the last line printed                     |) s
    816 278.5 204 M
    817 ('-------------------------+-------------------------------------------') s
    818 278.5 197 M
    819 (| \(.,.\)p                  | Prints the addressed lines. If invoked    |) s
    820 278.5 190 M
    821 (|                         | from a terminal, ed pauses at the end of  |) s
    822 278.5 183 M
    823 (|                         | each page until a newline is entered.     |) s
    824 278.5 176 M
    825 (|                         | The current address is set to the last    |) s
    826 278.5 169 M
    827 (|                         | line printed.                             |) s
    828 278.5 162 M
    829 ('-------------------------+-------------------------------------------') s
    830 278.5 155 M
    831 (| P                       | Toggles the command prompt on and off.    |) s
    832 278.5 148 M
    833 (|                         | Unless a prompt was specified by with     |) s
    834 278.5 141 M
    835 (|                         | command-line option -p string, the        |) s
    836 278.5 134 M
    837 (|                         | command prompt is by default turned off.  |) s
    838 278.5 127 M
    839 ('-------------------------+-------------------------------------------') s
    840 278.5 120 M
    841 (| q                       | Quits ed.                                 |) s
    842 278.5 113 M
    843 ('-------------------------+-------------------------------------------') s
    844 278.5 106 M
    845 (| Q                       | Quits ed unconditionally. This is similar |) s
    846 278.5 99 M
    847 (|                         | to the q command, except that unwritten   |) s
    848 278.5 92 M
    849 (|                         | changes are discarded without warning.    |) s
    850 278.5 85 M
    851 ('-------------------------+-------------------------------------------') s
    852 278.5 78 M
    853 (| \($\)r file               | Reads file to after the addressed line.   |) s
    854 278.5 71 M
    855 (|                         | If file is not specified, then the        |) s
    856 278.5 64 M
    857 (|                         | default filename is used. If there was no |) s
    858 278.5 57 M
    859 (|                         | default filename prior to the command,    |) s
    860 278.5 50 M
    861 (|                         | then the default filename is set to file. |) s
    862 278.5 43 M
    863 (|                         | Otherwise, the default filename is        |) s
    864 278.5 36 M
    865 (|                         | unchanged. The current address is set to  |) s
    866 278.5 29 M
    867 (|                         | the last line read.                       |) s
    868 278.5 22 M
    869 ('-------------------------+-------------------------------------------') s
    870 _R
    871 S
    872 %%Page: (2) 2
    873 %%BeginPageSetup
    874 _S
    875 24 24 translate
    876 /pagenum 2 def
    877 /fname () def
    878 /fdir (.) def
    879 /ftail (.) def
    880 /user_header_p false def
    881 /user_footer_p false def
    882 %%EndPageSetup
    883 5 785 M
    884 (.-------------------------+-------------------------------------------.) s
    885 5 778 M
    886 (| \($\)r !command           | Reads to after the addressed line the     |) s
    887 5 771 M
    888 (|                         | standard output of `!command',            |) s
    889 5 764 M
    890 (|                         | \(see the !command below\). The default     |) s
    891 5 757 M
    892 (|                         | filename is unchanged. The current        |) s
    893 5 750 M
    894 (|                         | address is set to the last line read.     |) s
    895 5 743 M
    896 ('-------------------------+-------------------------------------------') s
    897 5 736 M
    898 (| \(.,.\)s/re/replacement/  | Replaces text in the addressed lines      |) s
    899 5 729 M
    900 (| \(.,.\)s/re/replacement/g | matching a regular expression re with     |) s
    901 5 722 M
    902 (| \(.,.\)s/re/replacement/n | replacement. By default, only the first   |) s
    903 5 715 M
    904 (|                         | match in each line is replaced.           |) s
    905 5 708 M
    906 (|                         | If the `g' \(global\) suffix is given, then |) s
    907 5 701 M
    908 (|                         | every match to be replaced.               |) s
    909 5 694 M
    910 (|                         | The `n' suffix, where n is a positive     |) s
    911 5 687 M
    912 (|                         | number, causes only the n-th match to be  |) s
    913 5 680 M
    914 (|                         | replaced. It is an error if no            |) s
    915 5 673 M
    916 (|                         | substitutions are performed on any        |) s
    917 5 666 M
    918 (|                         | of the addressed lines. The current       |) s
    919 5 659 M
    920 (|                         | address is set the last line affected.    |) s
    921 5 652 M
    922 (|                         |                                           |) s
    923 5 645 M
    924 (|                         | re and replacement may be delimited by    |) s
    925 5 638 M
    926 (|                         | any character other than space and        |) s
    927 5 631 M
    928 (|                         | newline \(see the `s' command below\).      |) s
    929 5 624 M
    930 (|                         | If one or two of the last delimiters is   |) s
    931 5 617 M
    932 (|                         | omitted, then the last line affected is   |) s
    933 5 610 M
    934 (|                         | printed as though the print suffix `p'    |) s
    935 5 603 M
    936 (|                         | were specified.                           |) s
    937 5 596 M
    938 (|                         |                                           |) s
    939 5 589 M
    940 (|                         | An unescaped `&' in replacement is        |) s
    941 5 582 M
    942 (|                         | replaced by the currently matched text.   |) s
    943 5 575 M
    944 (|                         | The character sequence `\\m', where m is a |) s
    945 5 568 M
    946 (|                         | number in the range [1,9], is replaced by |) s
    947 5 561 M
    948 (|                         | the m-th backreference expression of the  |) s
    949 5 554 M
    950 (|                         | matched text. If replacement consists of  |) s
    951 5 547 M
    952 (|                         | a single `%', then replacement from the   |) s
    953 5 540 M
    954 (|                         | last substitution is used. Newlines may   |) s
    955 5 533 M
    956 (|                         | be embedded in replacement if they are    |) s
    957 5 526 M
    958 (|                         | escaped with a backslash \(\\\).             |) s
    959 5 519 M
    960 ('-------------------------+-------------------------------------------') s
    961 5 512 M
    962 (| \(.,.\)s                  | Repeats the last substitution. This form  |) s
    963 5 505 M
    964 (|                         | of the `s' command accepts a count suffix |) s
    965 5 498 M
    966 (|                         | `n', or any combination of the characters |) s
    967 5 491 M
    968 (|                         | `r', `g', and `p'.                        |) s
    969 5 484 M
    970 (|                         | If a count suffix `n' is given, then only |) s
    971 5 477 M
    972 (|                         | the n-th match is replaced.               |) s
    973 5 470 M
    974 (|                         | The `r' suffix causes the regular         |) s
    975 5 463 M
    976 (|                         | expression of the last search to be used  |) s
    977 5 456 M
    978 (|                         | instead of that of the last substitution. |) s
    979 5 449 M
    980 (|                         | The `g' suffix toggles the global suffix  |) s
    981 5 442 M
    982 (|                         | of the last substitution.                 |) s
    983 5 435 M
    984 (|                         | The `p' suffix toggles the print suffix   |) s
    985 5 428 M
    986 (|                         | of the last substitution. The current     |) s
    987 5 421 M
    988 (|                         | address is set to the last line affected. |) s
    989 5 414 M
    990 ('-------------------------+-------------------------------------------') s
    991 5 407 M
    992 (| \(.,.\)t\(.\)               | Copies \(i.e., transfers\) the addressed    |) s
    993 5 400 M
    994 (|                         | lines to after the right-hand destination |) s
    995 5 393 M
    996 (|                         | address, which may be the address         |) s
    997 5 386 M
    998 (|                         | 0 \(zero\). The current address is set to   |) s
    999 5 379 M
   1000 (|                         | the last line copied.                     |) s
   1001 5 372 M
   1002 ('-------------------------+-------------------------------------------') s
   1003 5 365 M
   1004 (| u                       | Undoes the last command and restores the  |) s
   1005 5 358 M
   1006 (|                         | current address to what it was before the |) s
   1007 5 351 M
   1008 (|                         | command.  The global commands `g', `G',   |) s
   1009 5 344 M
   1010 (|                         | `v', and `V' are treated as a single      |) s
   1011 5 337 M
   1012 (|                         | command by undo. `u' is its own inverse.  |) s
   1013 5 330 M
   1014 ('-------------------------+-------------------------------------------') s
   1015 5 323 M
   1016 (| \(1,$\)v/re/command-list  | Applies command-list to each of the       |) s
   1017 5 316 M
   1018 (|                         | addressed lines not matching a regular    |) s
   1019 5 309 M
   1020 (|                         | expression re. This is similar to the     |) s
   1021 5 302 M
   1022 (|                         | `g' command.                              |) s
   1023 5 295 M
   1024 ('-------------------------+-------------------------------------------') s
   1025 5 288 M
   1026 (| \(1,$\)V/re/              | Interactively edits the addressed lines   |) s
   1027 5 281 M
   1028 (|                         | not matching a regular expression re.     |) s
   1029 5 274 M
   1030 (|                         | This is similar to the `G' command.       |) s
   1031 5 267 M
   1032 ('-------------------------+-------------------------------------------') s
   1033 5 260 M
   1034 (| \(1,$\)w file             | Writes the addressed lines to file. Any   |) s
   1035 5 253 M
   1036 (|                         | previous contents of file is lost without |) s
   1037 5 246 M
   1038 (|                         | warning. If there is no default filename, |) s
   1039 5 239 M
   1040 (|                         | then the default filename is set to file, |) s
   1041 5 232 M
   1042 (|                         | otherwise it is unchanged. If no filename |) s
   1043 5 225 M
   1044 (|                         | is specified, then the default filename   |) s
   1045 5 218 M
   1046 (|                         | is used. The current address is unchanged.|) s
   1047 5 211 M
   1048 ('-------------------------+-------------------------------------------') s
   1049 5 204 M
   1050 (| \(1,$\)wq file            | Writes the addressed lines to file, and   |) s
   1051 5 197 M
   1052 (|                         | then executes a `q' command.              |) s
   1053 5 190 M
   1054 ('-------------------------+-------------------------------------------') s
   1055 5 183 M
   1056 (| \(1,$\)w !command         | Writes the addressed lines to the         |) s
   1057 5 176 M
   1058 (|                         | standard input of `!command', \(see the    |) s
   1059 5 169 M
   1060 (|                         | !command below\).                          |) s
   1061 5 162 M
   1062 (|                         | The defaultfilename and current address   |) s
   1063 5 155 M
   1064 (|                         | are unchanged.                            |) s
   1065 5 148 M
   1066 ('-------------------------+-------------------------------------------') s
   1067 5 141 M
   1068 (| \(1,$\)W file             | Appends the addressed lines to the end of |) s
   1069 5 134 M
   1070 (|                         | file. This is similar to the `w' command, |) s
   1071 5 127 M
   1072 (|                         | expect that the previous contents of file |) s
   1073 5 120 M
   1074 (|                         | is not clobbered. The current address is  |) s
   1075 5 113 M
   1076 (|                         | unchanged.                                |) s
   1077 5 106 M
   1078 ('-------------------------+-------------------------------------------') s
   1079 5 99 M
   1080 (| \(.\)x                    | Copies \(puts\) the contents of the cut     |) s
   1081 5 92 M
   1082 (|                         | buffer to after the addressed line.       |) s
   1083 5 85 M
   1084 (|                         | The current address is set to the last    |) s
   1085 5 78 M
   1086 (|                         | line copied.                              |) s
   1087 5 71 M
   1088 ('-------------------------+-------------------------------------------') s
   1089 5 64 M
   1090 (| \(.,.\)y                  | Copies \(yanks\) the addressed lines to the |) s
   1091 5 57 M
   1092 (|                         | cut buffer. The cut buffer is overwritten |) s
   1093 5 50 M
   1094 (|                         | by subsequent `y', `s', `j', `d', or `c'  |) s
   1095 5 43 M
   1096 (|                         | commands. The current address is          |) s
   1097 5 36 M
   1098 (|                         | unchanged.                                |) s
   1099 5 29 M
   1100 ('-------------------------+-------------------------------------------') s
   1101 278.5 785 M
   1102 (.-------------------------+-------------------------------------------.) s
   1103 278.5 778 M
   1104 (| \(.+1\)zn                 | Scrolls n lines at a time starting at     |) s
   1105 278.5 771 M
   1106 (|                         | addressed line. If n is not specified,    |) s
   1107 278.5 764 M
   1108 (|                         | then the current window size is used.     |) s
   1109 278.5 757 M
   1110 (|                         | The current address is set to the last    |) s
   1111 278.5 750 M
   1112 (|                         | line printed.                             |) s
   1113 278.5 743 M
   1114 ('-------------------------+-------------------------------------------') s
   1115 278.5 736 M
   1116 (| !command                | Executes command via sh\(1\). If the first  |) s
   1117 278.5 729 M
   1118 (|                         | character of command is `!', then it is   |) s
   1119 278.5 722 M
   1120 (|                         | replaced by text of the previous          |) s
   1121 278.5 715 M
   1122 (|                         | `!command'. ed does not process command   |) s
   1123 278.5 708 M
   1124 (|                         | for backslash \(\\\) escapes. However, an    |) s
   1125 278.5 701 M
   1126 (|                         | unescaped `%' is replaced by the default  |) s
   1127 278.5 694 M
   1128 (|                         | filename. When the shell returns from     |) s
   1129 278.5 687 M
   1130 (|                         | execution, a `!' is printed to the        |) s
   1131 278.5 680 M
   1132 (|                         | standard output. The current line is      |) s
   1133 278.5 673 M
   1134 (|                         | unchanged.                                |) s
   1135 278.5 666 M
   1136 ('-------------------------+-------------------------------------------') s
   1137 278.5 659 M
   1138 (| \(.,.\)#                  | Begins a comment; the rest of the line,   |) s
   1139 278.5 652 M
   1140 (|                         | up to a newline, is ignored. If a line    |) s
   1141 278.5 645 M
   1142 (|                         | address followed by a semicolon is given, |) s
   1143 278.5 638 M
   1144 (|                         | then the current address is set to that   |) s
   1145 278.5 631 M
   1146 (|                         | address. Otherwise, the current address   |) s
   1147 278.5 624 M
   1148 (|                         | is unchanged.                             |) s
   1149 278.5 617 M
   1150 ('-------------------------+-------------------------------------------') s
   1151 278.5 610 M
   1152 (| \($\)=                    | Prints the line number of the addressed   |) s
   1153 278.5 603 M
   1154 (|                         | line.                                     |) s
   1155 278.5 596 M
   1156 ('-------------------------+-------------------------------------------') s
   1157 278.5 589 M
   1158 (| \(.+1\)newline            | Prints the addressed line, and sets the   |) s
   1159 278.5 582 M
   1160 (|                         | current address to that line.             |) s
   1161 278.5 575 M
   1162 ('-------------------------'-------------------------------------------') s
   1163 278.5 561 M
   1164 ( =====================================================================) s
   1165 278.5 547 M
   1166 (.---------------------------------------------------------------------.) s
   1167 278.5 540 M
   1168 (| Peteris Krumins \(peter@catonmat.net\), 2007.08.22                    |) s
   1169 278.5 533 M
   1170 (| http://www.catonmat.net  -  good coders code, great reuse           |) s
   1171 278.5 526 M
   1172 ('---------------------------------------------------------------------') s
   1173 _R
   1174 S
   1175 %%Trailer
   1176 %%Pages: 2
   1177 %%DocumentNeededResources: font Courier-Bold DejaVuSansMono 
   1178 %%EOF