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 23:17:16 +0300

On Tue, Oct 12, 2021 at 09:42:11PM +0200, Khan Smith (khansmith@mail.com) wrote:

>    [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



reply via email to

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