On Mon, Feb 16, 2004 at 10:01:53PM +0100, Brian Foster wrote:
> I ran into a small annoyance today and am wondering if
> anyone has, or knows of, an existing fix/work-around
>> the problem is `col -b' emulates non-destructive BS
> (backspace), such as happens on hardcopy printers (e.g.,
> DECwriters, lineprinters, teletypes, &tc). namely,
> the sequence (where SP means SP (space) and BS means BS;
> for those not displaying UTF-8/Unicode correctly,
> a transliteration is given on the right):
>> x BS SP
>> where <x> is any _printing_ character, is turned into
> (by `col -b'):
>> x
no it isn't. it's turned into SP according to the man page:
-b Do not output any backspaces, printing only the last
character written to each column position.
> (this is quite possibly the only `col' transformation I
> care about --- there is no reverse line motion or (known)
in general i'd do something like this in perl:
#!/usr/bin/perl -n
chomp;
$i = 0;
@l = ();
foreach (split(//, $_)) {
if ($_ eq '\b') {
$i-- if ($i);
} else {
$l[$i++] = $_;
}
}
print(join("", @l). "\n");
but again, that's what col -b is supposed to do.
kevin
--
kevin at ie.suberic.net george will ethics report:
http://ie.suberic.net/~kevin/cgi-bin/bloghttp://tinyurl.com/2wya7
did george bush serve? http://www.calpundit.com/archives/003220.html
why does the gop cheer terrorists? http://craphound.com/images/sotu2004.avi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.linux.ie/pipermail/ilug/attachments/20040217/bc6f7f9f/attachment.pgp
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!