Re: quick grep question

From: Conrad J. Sabatier (conrads_at_cox.net)
Date: 04/19/05


Date: Tue, 19 Apr 2005 18:48:25 GMT

In article <1gva7oh.1vjvmqtemwelbN%spam@zeouane.org>,
spam <spam@zeouane.org> wrote:
>
>
>IHi,
>I have a directory structure, and I want to find a string in a file
>buried deep in that structure ..
>
> find . -name "filename" -exec grep "string" {}\;
>
>... would do it ?

Yes.

>Now if I want to *replace* that chain with something else ..? I'm lost.

find . -name "filename" -exec sed -i '' -e 's/oldstring/newstring/g' {} \;

Incidentally, this really isn't a FreeBSD-specific issue. Questions of this
nature are better directed to one of the other comp.unix.* groups, such as
comp.unix.shell or comp.unix.questions.

>Thanks in advance.

You're welcome.

-- 
Conrad J. Sabatier <conrads@cox.net> -- "In Unix veritas"


Relevant Pages

  • quick grep question
    ... I have a directory structure, and I want to find a string in a file ... buried deep in that structure .. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: strip away the directory structure on file name
    ... ShowFileName = Replace(strFullPath, Left(strFullPath, InStrRev(strFullPath, ... Function ShowFileName(strFullPath As String) ... In a sheet cell ... I get the directory structure too. ...
    (microsoft.public.excel)
  • Re: programmatic linking to external tables
    ... since the directory structure is static and the file naming convention ... Sub test() ... Dim filename As String ... Dim sourceSql As String ...
    (microsoft.public.access.queries)
  • Re: Printing Directories and their sub-directoreis
    ... > How do you print a folder with the sub-folders? ... Assuming your talking about printng the actual directory structure try this ... TO Email: Remove [SPAM] ...
    (microsoft.public.windowsxp.general)
  • Re: Newby Question FC4
    ... >> But the OP is looking for a specific string in a file in the directory ... Mild case of "answer fixation" I missed the -r. ... Prev by Date: ...
    (Fedora)