Lines Matching +full:to +full:- +full:regex +full:- +full:range
7 testcmd '- - twice' '"" - -' "hello\n" "" "hello\n"
8 testcmd '-n' '-n ""' "" "" "one\ntwo\nthree"
9 testcmd '-n p' '-n p' "one\ntwo\nthree" "" "one\ntwo\nthree"
10 testcmd 'explicit pattern' '-e p -n' "one\ntwo\nthree" "" "one\ntwo\nthree"
13 testcmd '' '-n 1p' "one\n" "" "one\ntwo\nthree"
15 testcmd '' '-n 2p' "two\n" "" "one\ntwo\nthree"
16 testcmd '-n $p' '-n \$p' "three" "" "one\ntwo\nthree"
17 testcmd 'as cat #2' "-n '1,\$p'" "one\ntwo\nthree" "" "one\ntwo\nthree"
19 testcmd '-n $,$p' '-n \$,\$p' 'three' '' 'one\ntwo\nthree'
20 testcmd '' '-n 1,2p' "one\ntwo\n" "" "one\ntwo\nthree"
21 testcmd '' '-n 2,3p' "two\nthree" "" "one\ntwo\nthree"
22 testcmd '' '-n 2,1p' "two\n" "" "one\ntwo\nthree"
23 testcmd '$ with 2 inputs' '-n \$p - input' "four\n" "four\n" "one\ntwo\nthree"
24 testcmd '' '-n /two/p' "two\n" "" "one\ntwo\nthree"
25 testcmd '' '-n 1,/two/p' 'one\ntwo\n' '' 'one\ntwo\nthree'
26 testcmd '' '-n /one/,2p' 'one\ntwo\n' '' 'one\ntwo\nthree'
27 testcmd '' '-n 1,/one/p' 'one\ntwo\nthree' '' 'one\ntwo\nthree'
28 testcmd '' '-n /one/,1p' 'one\n' '' 'one\ntwo\nthree'
29 testcmd '-n /two/,$p' '-n /two/,\$p' 'two\nthree' '' 'one\ntwo\nthree'
32 testcmd '' '-n 3p' "three" "" "one\ntwo\nthree"
33 testcmd 'prodigal newline' "-n '1,\$p' - input" \
35 testcmd 'Newline only added if further output' "-n 3p - input" "three" \
39 testcmd 'match \t tab' "-n '/\t/p'" "\tx\n" "" "\tx\n"
40 testcmd 'match t delim disables \t tab' "-n '\t\txtp'" "" "" "\tx\n"
41 testcmd 'match t delim makes \t literal t' "-n '\t\txtp'" "tx\n" "" "tx\n"
42 testcmd 'match n delim' "-n '\n\txnp'" "\tx\n" "" "\tx\n"
43 testcmd 'match n delim disables \n newline' "-n '\n\nxnp'" "" "" "\nx\n"
44 toyonly testcmd 'match \n literal n' "-n '\n\nxnp'" "nx\n" "" "nx\n"
46 "-n '/two/,/two/p'" "two\nthree" "" "one\ntwo\nthree"
48 "-n '2,/two/p'" "two\nthree" "" "one\ntwo\nthree"
49 testcmd 'num then regex' '-n 2,/d/p' 'b\nc\nd\n' '' 'a\nb\nc\nd\ne\nf\n'
50 testcmd 'regex then num' '-n /b/,4p' 'b\nc\nd\n' '' 'a\nb\nc\nd\ne\nf\n'
51 testcmd 'multiple regex address match' '-n /on/,/off/p' \
54 testcmd 'regex address overlap' '-n /on/,/off/p' "on\nzap\noffon\n" "" \
56 testcmd 'getdelim with nested [:blah:]' '-n "sa\a[a[:space:]bc]*aXXagp"' \
66 testcmd 'prodigaler newline' '-e a\\ -e woo' 'one\nwoo\n' '' 'one'
67 testcmd "aci" "-e '3a boom' -e '/hre/i bang' -e '3a whack' -e '3c bong'" \
70 testcmd "b loop" "':woo;=;b woo' | head -n 5" '1\n1\n1\n1\n1\n' "" "X"
71 testcmd "b skip" "-n '2b zap;d;:zap;p'" "two\n" "" "one\ntwo\nthree"
72 testcmd "b end" "-n '2b;p'" "one\nthree" "" "one\ntwo\nthree"
73 testcmd "c range" "'2,4c blah'" "one\nblah\nfive\nsix" "" \
75 testcmd "c {range}" "-e '2,4{c blah' -e '}'" "one\nblah\nblah\nblah\nfive\nsix"\
77 testcmd "c multiple continuation" "-e 'c\\' -e 'two\\' -e ''" "two\n\n" "" \
79 testcmd 'multiline continuations' '-e c\\ -e line1\\ -e line2' 'line1\nline2\n'\
81 toyonly testing "c empty continuation" "sed -e 'c\\'" "\n" "" "hello"
83 "sed -e '/one/,/three/{' -e 'i meep' -e'N;2D;}'" \
88 #testing 'sed what, _really_?' 'sed -e a\\ && echo yes really' \
93 testing "match empty line" "sed -e 's/^\$/@/'" "@\n" "" "\n"
103 testing '-n s//\1/p' "sed -n 's/t\\(w\\)o/za\\1py/p'" "zawpy" "" "one\ntwo"
104 testing '-n s//\1/p no newline' "sed -n 's/t\\(w\\)o/za\\1py/p'" "zawpy" \
109 testing 'empty match after nonempty match' "sed -e 's/a*/c/g'" 'cbcncgc' \
111 testing 'empty match' "sed -e 's/[^ac]*/A/g'" 'AaAcA' '' 'abcde'
112 testing 's///#comment' "sed -e 's/TWO/four/i#comment'" "one\nfour\nthree" \
114 testing 's///num off end' 'sed -e s/e//2' 'e\n' '' 'e\n'
117 "sed -e 'a woo' -e 'N;\$p'" 'woo\none\ntwo\none\ntwo' "" 'one\ntwo'
118 testing "delimiter in regex [char range] doesn't count" "sed -e 's/[/]//'" \
120 testing "delete regex range start line after trigger" \
121 "sed -e '/one/,/three/{' -e 'i meep' -e '1D;}'" \
124 "sed -e '/^three/s//abc&def/'" \
128 testcmd "interleave -e and -f" "-e 'a abc' -f input -e 'a ghi'" \
133 testing "" "sed -e '1a\' -e 'huh'" "meep\nhuh\n" "" "meep"
134 testing "" "sed -f input" "blah\nboom\n" '1a\\\nboom' 'blah'
135 testing "" "sed -f - input" "blah\nboom\n" 'blah' '1a\\\nboom'
139 testing "" "sed -e '/x/c\' -e 'y'" 'y\n' '' 'x\n'
140 testing "" "sed -e 's/a[([]*b/X/'" 'X' '' 'a[(b'
142 testing "[a-a] (for perl)" "sed '"'s/\([^a-zA-Z0-9.:_\-\/]\)/\\\1/g'"'" \
145 # Debian bug https://bugs.debian.org/635570 added code to ensure a file
146 # ends with a newline via "sed -e '$a\'". Apparently all a\ with no additional
151 # You have to match the first line of a range in order to activate
152 # the range, numeric and ascii work the same way
153 toyonly testing "skip start of range" "sed -e n -e '1,2s/b/c/'" "a\nb\n" "" "a\nb\n"
154 testing "range +1" "sed -ne '/blah/,+1p'" "blah\n6\n" "" \
156 testing "range +0" "sed -ne '/blah/,+0p'" "blah\n" "" \
158 testing "range +3" "sed -ne '2,+3p'" "2\n3\n4\n5\n" "" \
161 testing "not -s" "sed -n 1p input -" "one" "one" "two"
162 testing "-s" "sed -sn 1p input -" "one\ntwo" "one\n" "two"
165 "sed -e 'a \l \x\' -e \"\$(echo -e 'ab\\\nc')\"" \
169 testing "end b with }" "sed -n '/START/{:a;n;/END/q;p;ba}'" "b\nc\n" \
172 testcmd '-z' '-z "s/\n/-/g"' "a-b-c" "" "a\nb\nc"
173 testcmd '-z N' '-z N' 'one\0two\0' '' 'one\0two\0'
174 testcmd 'p noeol' '-z p' 'one\0one' '' 'one'
175 testcmd '-z N noeol' '-z N' 'one\0two' '' 'one\0two'
176 testcmd '-z S' "-z 'N;P'" 'one\0one\0two' '' 'one\0two'
177 testcmd '-z D' "-z 'N;D'" 'two' '' 'one\0two'
178 testcmd '-z G' "-z 'h;G'" 'one\0one' '' 'one'
179 testcmd '-z H' "-z 'H;g'" '\0one' '' 'one'
180 toyonly testcmd '-z x NOEOL' '-z ax' 'abc\0x\0def\0x\0' '' 'abc\0def'
187 '-E "s/(ARM_)?(NR_)([a-z]*) (.*)/\1\2\3/"' "NR_read" "" "NR_read foo"
188 # ...but also that we report an error for a backreference to a group that
190 testcmd '\n too high' '-E "s/(.*)/\2/p" 2>/dev/null || echo OK' "OK\n" "" "foo"
195 X=x; Y=20; while [ $Y -gt 0 ]; do X=$X$X; Y=$(($Y-1)); done
198 '138c1fa7c3f64186203b0192fb4abdb33cb4e98a -\n' '' "$X\n"
201 testcmd "w doesn't blank" "-e 'w one' -e 'w one' -e d; cat one" \
206 testcmd 's l ignores posix' "-n 'N;l'" 'one\\ntwo$\n' '' 'one\ntwo\n'
207 testcmd 's l loses missing newline' "-n 'N;l'" 'one\\ntwo$\n' '' 'one\ntwo'
208 testcmd 's -z l' "-zn 'N;l'" 'one\\000two$\0' '' 'one\0two\0'
209 testcmd 's -z l missing newline' "-zn 'N;l'" 'one\\000two$\0' '' 'one\0two'
213 # -i with $ last line test
215 #echo meep | sed/sed -e '1a\' -e 'huh'
216 #echo blah | sed/sed -f <(echo -e "1a\\\\\nboom")