tr equivalent to sed command

夜神 岩男 supergiantpotato at yahoo.co.jp
Sat Feb 25 08:29:32 UTC 2012


On 02/25/2012 12:43 PM, Patrick O'Callaghan wrote:
> On Fri, 2012-02-24 at 21:22 +0900, 夜神 岩男 wrote:
>> I'm trying to move a script from invoking lots of sed and awk to bash
>> builtins and I'm stumped on something I'm sure is simple.
>>
>> Is there a tr equivalent to the following?
> [...]
>
> You realize that tr is not a Bash builtin, right?

No, I didn't check, actually, thanks for pointing that out. The tr 
command is probably easier for some of the younger folks who will have 
to read this later on[1]. Now I'm curious and might run some tests on 
the two versions and see which is quicker -- though that's totally not 
the point with scripting (well, isn't supposed to be, anyway).

-IY

1. Rantesque continuation:
...as they seem so allergic to learning one or two sed commands that 
they will instead implement a parse/convert library from scratch in 
their favorite vanity language complete with intermediate working files 
and locks... and viola, new dependencies, attack vectors, opportunities 
for frozen jobs, etc are born.

I'm exagerrating, of course, but sadly not by much. In my current 
situation its far more likely that someone will look up and understand a 
command from coreutils than a spot of sed or my larger blobs of awk. I'm 
finding, to my chagrin, that what is easy and straightforward to me is 
clearly not easy and straightforward to the younger folks who came along 
after the Marketing Department decided that "all networking, ever" was 
synonomous with "web", and "all UIs, ever" were synonomous with "browser".


More information about the users mailing list