help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching inside files in a script


From: Tapani Tarvainen
Subject: Re: Searching inside files in a script
Date: Tue, 12 Oct 2021 22:52:36 +0300

On Tue, Oct 12, 2021 at 08:13:41PM +0200, Khan Smith (khansmith@mail.com) wrote:

>    I am trying to time the execution of grep using
> 
>    tim=${EPOCHREALTIME//[![:digit:]]/.}
> 
>    But tim is not returning anything

As others have already pointed out, there are easier ways for timing
grep. But nonetheless, that *should* also work, and it does work just
fine with me:

~$ LC_NUMERIC=fi_FI.utf8
~$ echo $EPOCHREALTIME
1634067790,469864
~$ tim=${EPOCHREALTIME//[![:digit:]]/.}
~$ echo $tim
1634067795.312455

If it really doesn't work for you, something's wrong; possibly you're
using too old version of bash - I believe EPOCHREALTIME was introduced
in bash 5.0.

Note, I deliberately set LC_NUMERIC that way to get a comma as the
decimal point, I presume that's the reason you're trying to do that
//[![:digit:]]/. thing.


-- 
Tapani Tarvainen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]