[Bug 6884] the sed applet behaves erraticaly when script from file (option -f)
bugzilla at busybox.net
bugzilla at busybox.net
Fri Feb 21 13:38:12 UTC 2014
https://bugs.busybox.net/show_bug.cgi?id=6884
Denys Vlasenko <vda.linux at googlemail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Denys Vlasenko <vda.linux at googlemail.com> 2014-02-21 13:38:12 UTC ---
(In reply to comment #0)
> Created attachment 5240 [details]
> tarball of the web extraction used as sample to reproduce the bug
>
> context (used as bash for the shell and sed for the operations) :
> BusyBox v1.23.0-TIG-1381-g883817e (2014-01-21 14:06:02 GMT) multi-call binary.
>
> i perform a succession of transformations with bb's sed on a given file (see
> attached for a sample).
>
> 1. on the command line :
> $ cat samp.htm | sed -r "/sens=achat/! d; s/^[^<]*<//g; s/<tr /\n&/g" | sed
> -r "s/.*symbole=([^']*)' title=([^>]*)[^<]*<\/a><\/td>/\"\1\";\2;/g"
> works as expected.
>
> 2. and i want to do the same via a sed file :
> $ cat samp.htm | sed -rf f2.sed
> where f2. contains the following (without the line numbering):
> 1- /sens=achat/! d
> 2- s/^[^<]*<//g; s/<tr /\n&/g
> 3- s/.*symbole=([^']*)' title=([^>]*)[^<]*<\/a><\/td>/\"\1\";\2;/g
> but it seems that the script doesn't go beyond line 2 (as if, for the cli
> version, the last pipe was skipped!)
(You need to stop escaping \" in the file version. IOW: \"\1\" should be "\1"
there).
For me the script doesn't work as if line 3 is missing. The output is different
from that too.
However: without going deeper into what the scripts are doing, I tried
GNU sed version 4.2.1 on them too, and it and busybox sed gave exactly
the same results on both your testcases.
Moreover,
sed -r \
-e "/sens=achat/! d; s/^[^<]*<//g; s/<tr /\n&/g" \
-e "s/.*symbole=([^']*)' title=([^>]*)[^<]*<\/a><\/td>/\"\1\";\2;/g"
that is, single process instead of two seds piped, works the same as the
version with -f FILE.
I guess you are inserting \n chars to break lines and expect sed to detect
those as new lines to operate one. This doesn't work.
--
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list