help-bash
[Top][All Lists]
Advanced

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

Searching inside files in a script


From: Khan Smith
Subject: Searching inside files in a script
Date: Tue, 12 Oct 2021 22:03:24 +0200

   Sent: Tuesday, October 12, 2021 at 7:52 PM
   From: "Tapani Tarvainen" <bash@tapanitarvainen.fi>
   To: help-bash@gnu.org
   Subject: Re: Searching inside files in a script
   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.

   You are right, the distribution is using bash version 4.4.20

   Have now installed bash version 5.1.8.

   The readme file only says
To compile Bash, type `./configure', then `make'.  Bash auto-configures
the build process, so no further intervention should be necessary.

   It would help if the readme file tells users that they also have to run
   "sudo make install" for Bash to be installed.

   Otherwise, doing `bash --version` still returns the old version
   provided by the distribution.


reply via email to

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