[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: |
Wed, 13 Oct 2021 00:59:03 +0200 |
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
- Re: Searching inside files in a script, (continued)
- Re: Searching inside files in a script, Alex fxmbsw7 Ratchev, 2021/10/12
- Searching inside files in a script, Khan Smith, 2021/10/12
- Re: Searching inside files in a script, Dennis Williamson, 2021/10/12
- Searching inside files in a script, Khan Smith, 2021/10/12
- Re: Searching inside files in a script, Dennis Williamson, 2021/10/12
- Searching inside files in a script, Khan Smith, 2021/10/12
- Re: Searching inside files in a script, Dennis Williamson, 2021/10/12
- Searching inside files in a script, Khan Smith, 2021/10/12
- Re: Searching inside files in a script, Tapani Tarvainen, 2021/10/12
- Searching inside files in a script, Khan Smith, 2021/10/12
- Searching inside files in a script,
Khan Smith <=
- Re: Searching inside files in a script, Alex fxmbsw7 Ratchev, 2021/10/12
- Searching inside files in a script, Khan Smith, 2021/10/12
- Re: Searching inside files in a script, Tapani Tarvainen, 2021/10/12
- Re: Searching inside files in a script, Dennis Williamson, 2021/10/12
- Re: Searching inside files in a script, Tapani Tarvainen, 2021/10/12
- Re: Searching inside files in a script, Greg Wooledge, 2021/10/12
- Searching inside files in a script, Khan Smith, 2021/10/12