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 21:42:11 +0200



   Sent: Tuesday, October 12, 2021 at 7:24 PM
   From: "Dennis Williamson" <dennistwilliamson@gmail.com>
   To: "Khan Smith" <khansmith@mail.com>
   Cc: "Alex fxmbsw7 Ratchev" <fxmbsw7@gmail.com>, "help-bash"
   <help-bash@gnu.org>
   Subject: Re: Searching inside files in a script
   On Tue, Oct 12, 2021, 2:20 PM Khan Smith <khansmith@mail.com> wrote:
   >
   > *Sent:* Tuesday, October 12, 2021 at 6:22 PM
   > *From:* "Dennis Williamson" <dennistwilliamson@gmail.com>
   > *To:* "Khan Smith" <khansmith@mail.com>
   > *Cc:* "Alex fxmbsw7 Ratchev" <fxmbsw7@gmail.com>, "help-bash" <
   > help-bash@gnu.org>
   > *Subject:* Re: Searching inside files in a script
   > On Tue, Oct 12, 2021, 1:14 PM Khan Smith <khansmith@mail.com> wrote:
   >
   > >
   > > Sent: Tuesday, October 12, 2021 at 3:46 PM
   > > From: "Alex fxmbsw7 Ratchev" <fxmbsw7@gmail.com>
   > > To: "Khan Smith" <khansmith@mail.com>
   > > Cc: "help-bash" <help-bash@gnu.org>
   > > Subject: Re: Searching inside files in a script
   > > grep -r 'pattern' dir
   > > possibly -E or -P or -F
   > > -r for recursive into dirs
   > >
   > >
   > >
   > > I am trying to time the execution of grep using
   > >
   > > tim=${EPOCHREALTIME//[![:digit:]]/.}
   > >
   > > But tim is not returning anything
   > >
   > >
   > > On Tue, Oct 12, 2021, 17:38 Khan Smith <[1]khansmith@mail.com>
   wrote:
   > >
   > > I am getting a number of error messages related to functionality
   > > I
   > > source to. I would like to have a function I can run to search a
   > > text
   > > pattern on specific directories or files. What can I do?
   > > If I select a directory, I want to search inside the files in
   > > that
   > > directory.
   > >
   > > References
   > >
   > > 1. mailto:khansmith@mail.com
   >
   >
   > Instead of doing it yourself just do
   >
   > time grep...
   >
   > Does the "time grep..." command also run grep? For the timing part,
   how
   > would I pass the result
   > to a variable for printing?
   >
   >
   >
   [1]https://mywiki.wooledge.org/BashFAQ/032

   That is too complicated for me. I have

   grep -r "${isufx[@]}" -e "$ptrn" -- "${fdir[@]}"

References

   1. https://mywiki.wooledge.org/BashFAQ/032


reply via email to

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