fixed a bug in handling QSE_SED_QUIET for the 'n' command

This commit is contained in:
2009-09-05 07:08:19 +00:00
parent 10c75d357d
commit f14f01864d
25 changed files with 310 additions and 109 deletions

View File

@ -0,0 +1,8 @@
{
if ($0 ~ /^-+$/) {
getline x; printf " %s\n", x; nobar=0;
}
else {
if (nobar) printf "\n"; printf "%s", $0; nobar=1;
}
}

View File

@ -0,0 +1,23 @@
ab...c
------
AAA
de...f
gh...i
------
AAA1
jk...l
mn...o
pq...r
------
AAA2
kbs
------
ddd
dif
------
cccc

View File

@ -0,0 +1,9 @@
BEGIN {
RS="\n-+\n";
first = 1;
}
{
if (!first) printf " ";
printf "%s", $0;
first = 0;
}

View File

@ -0,0 +1,23 @@
ab...c
------
AAA
de...f
gh...i
------
AAA1
jk...l
mn...o
pq...r
------
AAA2
kbs
------
ddd
dif
------
cccc

View File

@ -1931,6 +1931,66 @@ lease 10.218.255.151 {
uid "\001\000\033[\234\220\000";
}
--------------------------------------------------------------------------------
../../cmd/awk/qseawk --newline=on -o- -f lang-036.awk lang-036.dat </dev/stdin 2>&1
--------------------------------------------------------------------------------
{
if (($0 ~ /^-+$/))
{
(getline x);
printf " %s\n",x;
nobar = 0;
}
else
{
if (nobar)
printf "\n";
printf "%s",$0;
nobar = 1;
}
}
ab...c AAA
de...f
gh...i AAA1
jk...l
mn...o
pq...r AAA2
kbs ddd
dif cccc
--------------------------------------------------------------------------------
../../cmd/awk/qseawk --newline=on -o- -f lang-037.awk lang-037.dat </dev/stdin 2>&1
--------------------------------------------------------------------------------
BEGIN {
RS = "\n-+\n";
first = 1;
}
{
if ((!(first)))
printf " ";
printf "%s",$0;
first = 0;
}
ab...c AAA
de...f
gh...i AAA1
jk...l
mn...o
pq...r AAA2
kbs ddd
dif cccc
--------------------------------------------------------------------------------
../../cmd/awk/qseawk -f quicksort.awk quicksort.dat </dev/stdin 2>&1
--------------------------------------------------------------------------------
0.0000000000

View File

@ -138,6 +138,8 @@ PROGS="
lang-033.awk///--newline=on -o-
lang-034.awk///--newline=on --rwpipe=on -o-
lang-035.awk/lang-035.dat2//--newline=on -o- -vdatafile=lang-035.dat1 -vgroupname=lang-035
lang-036.awk/lang-036.dat//--newline=on -o-
lang-037.awk/lang-037.dat//--newline=on -o-
quicksort.awk/quicksort.dat//
quicksort2.awk/quicksort2.dat//

23
qse/regress/sed/001.dat Normal file
View File

@ -0,0 +1,23 @@
ab...c
------
AAA
de...f
gh...i
------
AAA1
jk...l
mn...o
pq...r
------
AAA2
kbs
------
ddd
dif
------
cccc

14
qse/regress/sed/001.sed Normal file
View File

@ -0,0 +1,14 @@
# require -n
h
:again n
/^-+$/ {
g
N
s/\n/ /
p
b skip
}
x
p
b again
:skip