Recently Written · git

tmpl

Insanely simple templates

git clone https://github.com/equwal/tmpl

Log | Files | Refs


sed/TLDR (707 bytes)

1 Careful to not use GNU "extensions" in your POSIX sed:
2 
3 no -i
4 no ; (use a newline)
5 
6 Plan9 sed has:
7 sed [ -gln ] [ -e script ] [ -f scriptfile ] [ file ... ]
8 
9 (range spec)command {args}
10 ! opposite range spec
11 
12 a\      text on next line
13 text
14 
15 i\      text on previous line
16 txt
17 
18 c\      replace the line with text (ie. s/^.*$/text/)
19 text
20 
21 N join next line
22 
23 dD delete pattern space, DELETE FIRST LINE IN PATTERN SPACE
24 
25 hH pattern space->hold space, APPENDING
26 gG hold space->pattern space, APPENDING
27 x hold space "exchange" pattern space
28 
29 pnP print, print and next, PRINT FIRST LINE
30 
31 = print line number
32 {} group commands
33 
34 r {file} read file into output
35 w {file} write (appending) to file
36 tb: label jumps
37 
38 q quit