57 |
testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n" |
testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n" |
58 |
testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n" |
testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n" |
59 |
testing "sed s [delimiter]" "sed -e 's@[@]@@'" "onetwo" "" "one@two" |
testing "sed s [delimiter]" "sed -e 's@[@]@@'" "onetwo" "" "one@two" |
60 |
|
testing "sed s with \\t (GNU ext)" "sed 's/\t/ /'" "one two" "" "one\ttwo" |
61 |
|
|
62 |
# branch |
# branch |
63 |
testing "sed b (branch)" "sed -e 'b one;p;: one'" "foo\n" "" "foo\n" |
testing "sed b (branch)" "sed -e 'b one;p;: one'" "foo\n" "" "foo\n" |
140 |
testing "sed clusternewline" \ |
testing "sed clusternewline" \ |
141 |
"sed -e '/one/a 111' -e '/two/i 222' -e p input -" \ |
"sed -e '/one/a 111' -e '/two/i 222' -e p input -" \ |
142 |
"one\none\n111\n222\ntwo\ntwo" "one" "two" |
"one\none\n111\n222\ntwo\ntwo" "one" "two" |
143 |
|
testing "sed subst+write" \ |
144 |
|
"sed -e 's/i/z/' -e 'woutputw' input -; echo -n X; cat outputw" \ |
145 |
|
"thzngy\nagaznXthzngy\nagazn" "thingy" "again" |
146 |
|
rm outputw |
147 |
|
testing "sed trailing NUL" \ |
148 |
|
"sed 's/i/z/' input -" \ |
149 |
|
"a\0b\0\nc" "a\0b\0" "c" |
150 |
|
testing "sed escaped newline in command" \ |
151 |
|
"sed 's/a/z\\ |
152 |
|
z/' input" \ |
153 |
|
"z\nz" "a" "" |
154 |
|
|
155 |
# Test end-of-file matching behavior |
# Test end-of-file matching behavior |
156 |
|
|
158 |
"hello\nthere" |
"hello\nthere" |
159 |
testing "sed match EOF two files" "sed -e '"'$p'"' input -" \ |
testing "sed match EOF two files" "sed -e '"'$p'"' input -" \ |
160 |
"one\ntwo\nthree\nfour\nfour" "one\ntwo" "three\nfour" |
"one\ntwo\nthree\nfour\nfour" "one\ntwo" "three\nfour" |
161 |
echo -ne "three\nfour" > input2 |
# sed match EOF inline: gnu sed 4.1.5 outputs this: |
162 |
|
#00000000 6f 6e 65 0a 6f 6f 6b 0a 6f 6f 6b 0a 74 77 6f 0a |one.ook.ook.two.| |
163 |
|
#00000010 0a 74 68 72 65 65 0a 6f 6f 6b 0a 6f 6f 6b 0a 66 |.three.ook.ook.f| |
164 |
|
#00000020 6f 75 72 |our| |
165 |
|
# which looks buggy to me. |
166 |
|
$ECHO -ne "three\nfour" > input2 |
167 |
testing "sed match EOF inline" \ |
testing "sed match EOF inline" \ |
168 |
"sed -e '"'$i ook'"' -i input input2 && cat input input2" \ |
"sed -e '"'$i ook'"' -i input input2 && cat input input2" \ |
169 |
"one\nook\ntwothree\nook\nfour" "one\ntwo" "" |
"one\nook\ntwothree\nook\nfour" "one\ntwo" "" |
201 |
#testing "sed -g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5," \ |
#testing "sed -g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5," \ |
202 |
# "" "12345" |
# "" "12345" |
203 |
|
|
204 |
|
# testing "description" "arguments" "result" "infile" "stdin" |
205 |
|
|
206 |
|
testing "sed n command must reset 'substituted' bit" \ |
207 |
|
"sed 's/1/x/;T;n;: next;s/3/y/;t quit;n;b next;: quit;q'" \ |
208 |
|
"0\nx\n2\ny\n" "" "0\n1\n2\n3\n" |
209 |
|
|
210 |
exit $FAILCOUNT |
exit $FAILCOUNT |