LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] col(1)-ish tool emulating destructive ^H ?

[ILUG] col(1)-ish tool emulating destructive ^H ?

kevin lyda kevin+dated+1077413703.73b08f at ie.suberic.net
Tue Feb 17 01:34:59 GMT 2004


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/blog   http://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


More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell