change chr(9) ?

Discussion in 'Perl Misc' started by max, Feb 28, 2007.

  1. max

    max Guest

    Help

    I have txt file with chr(9) in text, how to change chr(9) - horizontal tab
    to chr(32)"space"
    max, Feb 28, 2007
    #1
    1. Advertising

  2. max

    Ben Morrow Guest

    Quoth "max" <>:
    > Help
    >
    > I have txt file with chr(9) in text, how to change chr(9) - horizontal tab
    > to chr(32)"space"


    perl -i~ -pe'tr/\t/ /' txtfile

    Ben

    --
    'Deserve [death]? I daresay he did. Many live that deserve death. And some die
    that deserve life. Can you give it to them? Then do not be too eager to deal
    out death in judgement. For even the very wise cannot see all ends.'
    Ben Morrow, Feb 28, 2007
    #2
    1. Advertising

  3. Abigail wrote:
    > max wrote:
    > !! I have txt file with chr(9) in text, how to change chr(9) - horizontal tab
    > !! to chr(32)"space"
    >
    > I'd use 'tr'. But that isn't Perl.


    Why do you say that 'tr' is not Perl?

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Feb 28, 2007
    #3
  4. max

    Ben Morrow Guest

    Quoth Gunnar Hjalmarsson <>:
    > Abigail wrote:
    > > max wrote:
    > > !! I have txt file with chr(9) in text, how to change chr(9) - horizontal tab
    > > !! to chr(32)"space"
    > >
    > > I'd use 'tr'. But that isn't Perl.

    >
    > Why do you say that 'tr' is not Perl?


    Because Abigail was referring to the tr(1) Unix utility, which is not
    Perl. Perl derives its tr/// operator from the tr(1) utility.

    Ben

    --
    I must not fear. Fear is the mind-killer. I will face my fear and
    I will let it pass through me. When the fear is gone there will be
    nothing. Only I will remain.
    Frank Herbert, 'Dune'
    Ben Morrow, Feb 28, 2007
    #4
  5. Abigail wrote:
    > Gunnar Hjalmarsson wrote:
    > ][ Abigail wrote:
    > ][ > max wrote:
    > ][ > !! I have txt file with chr(9) in text, how to change chr(9) - horizontal tab
    > ][ > !! to chr(32)"space"
    > ][ >
    > ][ > I'd use 'tr'. But that isn't Perl.
    > ][
    > ][ Why do you say that 'tr' is not Perl?
    >
    > $ which tr
    > /usr/bin/tr
    > $ which perl
    > /opt/perl/bin/perl


    Well, since this is a Perl group, the readers had good reasons to assume
    that you were referring to the Perl operator tr///.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Feb 28, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. crjunk
    Replies:
    2
    Views:
    16,835
    crjunk
    Aug 8, 2003
  2. Andi Twine
    Replies:
    3
    Views:
    548
    Natty Gur
    Jan 13, 2004
  3. =?Utf-8?B?RGFuIE5hc2g=?=

    C# equiv of Chr(13)

    =?Utf-8?B?RGFuIE5hc2g=?=, Nov 1, 2004, in forum: ASP .Net
    Replies:
    12
    Views:
    74,278
    Dudeman3000
    Feb 22, 2010
  4. ProJee
    Replies:
    3
    Views:
    439
    ProJee
    Nov 17, 2004
  5. MattB
    Replies:
    3
    Views:
    552
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Nov 19, 2004
Loading...

Share This Page