I am trying to use rlwrap with sam -d for structural regular expressions in the taste of ed. However, sam sometimes outputs text that does not contain new lines. Here is an example.
$ cat input.txt
&Book: Programming Perl
&Author: Larry Wall&Author: Tom Christiansen&Author: Jon Orwant
&ISBN: 0-596-00027-8
And now I do this (note that sam is part of plan9port so should be invoked as 9 sam).
$ rlwrap 9 sam -d input.txt
-. input.txt
2x/^&[^&]+
&Author: Larry Wall▌
Here, 2x/^&[^&]+ means "taking line 2 as input, extract text that starts at the beginning of the line with & and that ends before another &".
You can see that sam did not output a newline character (▌ represents the cursor position), because it extracted only the inline part, which is normal.
But I would still like rlwrap to always display a newline at the end of outputs.
I tried with a filter with this, but I still don't have a newline at the end.
rlwrap -z "makefilter awk '{print}'" 9 sam -d -a input.txt
I am trying to use rlwrap with
sam -d
for structural regular expressions in the taste ofed
. However,sam
sometimes outputs text that does not contain new lines. Here is an example.And now I do this (note that
sam
is part ofplan9port
so should be invoked as9 sam
).Here,
2x/^&[^&]+
means "taking line 2 as input, extract text that starts at the beginning of the line with&
and that ends before another&
".You can see that
sam
did not output a newline character (▌
represents the cursor position), because it extracted only the inline part, which is normal.But I would still like
rlwrap
to always display a newline at the end of outputs.I tried with a filter with this, but I still don't have a newline at the end.
Do you have guidance on how to do this? Thanks.