Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How to replace \t with \s

by hippo (Bishop)
on Jan 20, 2021 at 14:31 UTC ( [id://11127145]=note: print w/replies, xml ) Need Help??


in reply to How to replace \t with \s

I want to do something like this: tr/\t/\s\s\s\s/ ## replace \t with 4 spaces
$ hexdump -C foo 00000000 61 09 62 62 62 09 63 63 63 63 63 63 09 64 0a |a.bbb.ccc +ccc.d.| 0000000f $ perl -ple '$_ = join " ", split /\t+/' foo > bar $ hexdump -C bar 00000000 61 20 20 20 20 62 62 62 20 20 20 20 63 63 63 63 |a bbb + cccc| 00000010 63 63 20 20 20 20 64 0a |cc d.| 00000018 $

Edit: restricted now just to replacing tabs as this is presumably what was originally meant.


🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11127145]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-25 15:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found