Sponsored Content
Full Discussion: Recursive Grep with replace
Top Forums Shell Programming and Scripting Recursive Grep with replace Post 302601359 by alister on Thursday 23rd of February 2012 12:41:58 PM
Old 02-23-2012
Code:
find . -type f -exec ex -sc '%s/old/new/g|x' {} \;

You may want to restrict the match to word boundaries with \< and \>. As with any mass editing, make sure to test thoroughly and/or have backups available.

Regards,
Alister
This User Gave Thanks to alister For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep recursive directories

I am trying to locate a file or files with specific data in them. Problem is the file(s) could reside in any one of many directories. My question is. Is there a way of recursively greping directories for the file(s) with the data I am looking for. I have tried - 1. $HOME> grep 47518 | ls... (8 Replies)
Discussion started by: jagannatha
8 Replies

2. UNIX for Dummies Questions & Answers

recursive GREP ?

Hi! Suppose I have a directory (no symbolic links) called /WORK that contains 3 subdirectories: /A /B /C My problem is this: I want to look for a file that contains an order number. So far, I obtain what I want by doing this /home/acb% cd /WORK/A /home/acb/WORK/A% grep '093023553' *.*... (3 Replies)
Discussion started by: alan
3 Replies

3. Shell Programming and Scripting

Recursive Search and replace only when found string

Hello all ( again ) I will like to search and replace string in text file ok I can loop throw the files like : foreach f ( ` find . -name "*."`) .. but here I like to examine the file if in contain the desired string and so do the sed -e 's/blah/foo/g' thingy on it or there is better way... (1 Reply)
Discussion started by: umen
1 Replies

4. UNIX for Dummies Questions & Answers

Recursive grep

Hello, First time post - I have no formal unix training and could use some help with this. I have a list of strings in File1 that I want to use to do a recursive search (grep) under a specific directory. Here is an example of the string I need to search: /directory/dire... (16 Replies)
Discussion started by: upstate_boy
16 Replies

5. UNIX for Dummies Questions & Answers

recursive grep output

I'm using this command to get a recursive grep find . -name *.i -exec grep 'blah blah' {} \; -exec ls {} \; now I would like to obtain just the list of the files and not also the line of the file. How should I change the syntax? thank you, (5 Replies)
Discussion started by: f_o_555
5 Replies

6. Shell Programming and Scripting

Preventing an endless loop with recursive grep

When finding a string in files within a directory, one can use this: grep -r "searchstring" dir/subdir/ > listofoccurrences.txt For brevity sake one can enter the intended directory and use this: grep -r "searchstring" . > listofoccurrences.txt which as I found out leads to an endless loop,... (2 Replies)
Discussion started by: figaro
2 Replies

7. UNIX for Advanced & Expert Users

recursive grep

Hi, on AIX 6.1 , in man document for grep : -r Searches directories recursively. By default, links to directories are followed. But when I use : oracle@XXX:/appli/XXX_SCRIPTS#grep -r subject *.sh It returns nothing. However I have at least one row in a file : ... (3 Replies)
Discussion started by: big123456
3 Replies

8. Shell Programming and Scripting

Tricky recursive removal (find with grep)

Tricky one: I want to do several things all at once to blow away a directory (rm -rf <dir>) 1) I want to find all files recursively that have a specific file extension (.ver) for example. 2) Then in that file, I want to grep for an expression ( "sp2" ) for example. 3) Then I want to... (1 Reply)
Discussion started by: jvsrvcs
1 Replies

9. UNIX for Advanced & Expert Users

Recursive grep with only certain types of files

Can I please have some ideas on how to do a recursive grep with certain types of files? The file types I want to use are *.c and *.java. I know this normally works with all files. grep -riI 'scanner' /home/bob/ 2>/dev/null Just not sure how to get it to work *.c and *.java files. (5 Replies)
Discussion started by: cokedude
5 Replies
mass(3rheolef)							    rheolef-6.1 						    mass(3rheolef)

NAME
mass -- L2 scalar product SYNOPSIS
form(const space& V, const space& V, "mass"); form(const space& M, const space& V, "mass"); form (const space& V, const space& V, "mass", const domain& gamma); form_diag(const space& V, "mass"); DESCRIPTION
Assembly the matrix associated to the L2 scalar product of the finite element space V. / | m(u,v) = | u v dx | / Omega The V space may be either a P0, P1, P2, bubble, P1d and P1d finite element spaces for building a form see form(2). The use of quadrature formulae is sometime usefull for building diagonal matrix. These approximate matrix are eay to invert. This proce- dure is available for P0 and P1 approximations. Notes that when dealing with discontinuous finite element space, i.e. P0 and P1d, the corresponding mass matrix is block diagonal, and the inv_mass form may be usefull. When two different space M and V are supplied, assembly the matrix associated to the projection operator from one finite element space M to space V. / | m(q,v) = | q v dx | / Omega for all q in M and v in V. This form is usefull for instance to convert discontinuous gradient components to a continuous approximation. The transpose operator may also be usefull to performs the opposite operation. The following $V$ and $M$ space approximation combinations are supported for the mass form: P0-P1, P0-P1d, P1d-P2, P1-P1d and P1-P2. EXAMPLE
The following piece of code build the mass matrix associated to the P1 approximation: geo g("square"); space V(g, "P1"); form m(V, V, "mass"); The use of lumped mass form write also: form_diag md(V, "mass"); The following piece of code build the projection form: geo g("square"); space V(g, "P1"); space M(g, "P0"); form m(M, V, "mass"); SCALAR PRODUCT ON THE BOUNDARY
Assembly the matrix associated to the L2 scalar product related to a boundary domain of a mesh and a specified polynomial approximation. These forms are usefull when defining non-homogeneous Neumann or Robin boundary conditions. Let W be a space of functions defined on Gamma, a subset of the boundary of the whole domain Omega. / | m(u,v) = | u v dx | / Gamma for all u, v in W. Let V a space of functions defined on Omega and gamma the trace operator from V into W. For all u in W and v in V: / | mb(u,v) = | u gamma(v) dx | / Gamma For all u and v in V: / | ab(u,v) = | gamma(u) gamma(v) dx | / Gamma EXAMPLE
The following piece of code build forms for the P1 approximation, assuming that the mesh contains a domain named boundary: geo omega ("square"); domain gamma = omega.boundary(); space V (omega, "P1"); space W (omega, gamma, "P1"); form m (W, W, "mass"); form mb (W, V, "mass"); form ab (V, V, "mass", gamma); SEE ALSO
form(2) rheolef-6.1 rheolef-6.1 mass(3rheolef)
All times are GMT -4. The time now is 02:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy