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: Alex fxmbsw7 Ratchev
Subject: Re: Searching inside files in a script
Date: Wed, 13 Oct 2021 03:39:58 +0200

unset IFS ; t=( ) t+=( $EPOCHREALTIME ) ; sleep 1 ; t+=( $EPOCHREALTIME )

d=( $( gawk -v RS='[ \n]' '{ if ( ! t ) t = $1 ; else { print $1 - t ; t =
$1 } }' <<<${t[@]} ) ) ; declare -p d

declare -a d=([0]="1.01743")

On Wed, Oct 13, 2021, 00:59 Khan Smith <khansmith@mail.com> wrote:

>
>    I am running my script by sourcing it from my .bashrc.  But the
>    distribution uses bash version 4.4.20.
>
>    Have installed bash version 5.1.8 which gets installed in
>    /usr/local/bin/
>
>    Can one install bash version 5.1.8 so it is the dafaulh or do I run the
>    risk of having the OS apply an
>    update to its own built-in Bash package?
>
>    Sent: Tuesday, October 12, 2021 at 8:17 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 09:42:11PM +0200, Khan Smith
>    (khansmith@mail.com) wrote:
>    > [1][1][1]https://mywiki.wooledge.org/BashFAQ/032
>    >
>    > That is too complicated for me. I have
>    >
>    > grep -r "${isufx[@]}" -e "$ptrn" -- "${fdir[@]}"
>    Try this:
>    TIMEFORMAT='%R'
>    tim=$( { time grep -r "${isufx[@]}" -e "$ptrn" -- "${fdir[@]}"
>    >/dev/null; } 2>&1)
>    TIMEFORMAT can also contain %U for user time or %S for system time
>    (and some other stuff as well, see bash man page for details).
>    If you wish to save the grep output, redirect it to a file rather than
>    /dev/null.
>    --
>    Tapani Tarvainen
>    References
>    1. [2]https://mywiki.wooledge.org/BashFAQ/032
>
> References
>
>    1. https://mywiki.wooledge.org/BashFAQ/032
>    2. https://mywiki.wooledge.org/BashFAQ/032
>


reply via email to

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