Global search ok...but replace?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Global search ok...but replace?
# 1  
Old 03-25-2004
Global search ok...but replace?

Gurus,

I have in my /tmp directory 26 files "filea", "fileb"..."filez". Each file contains the name of a database 'dwora' at many, many places within each file.

My boss decided to change the name of the db so I need to do (what i'd call) a global search&replace of that string in all my files.

So far, I am able to accomplish the following:
[orcl@dev1]/orcl/tmp/find . -name 'file*' -exec grep dwmora {} \; -exec sed 's/dwora/dworacle/g' {} \;

it outputs to my terminal/screen successfully. However, I want to output my mods in each file from "file*" to "file*.new"....and I can't seem to find the right syntax. I know I can do sed 's/dwora/dworacle/g' filea > filea.new but when I try for multiple files at once, it fails.

What am I missing here?Help, please!
Smilie

ps: I am running HP-UX dev1 B.11.00 U 9000/800
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Global replace command help

Hello - I am trying to use a global replace command but its not working. Here is the cmd I am using in vi: :%s/OLD/NEW/g However, in my "NEW" I already have a "/" which is not making the replace work: :%s/mytestscript.com:33232/mytestscript:70245/test.com/g the... (2 Replies)
Discussion started by: DallasT
2 Replies

2. Shell Programming and Scripting

Global replace with perl in bash

I am newbie to perl, I am trying to use the below syntax to replace globally a string with a variable. $ bash -version GNU bash, version 2.05b.0(1)-release (powerpc-ibm-aix5.1) Copyright (C) 2002 Free Software Foundation, Inc. $ perl -version This is perl, v5.8.8 built for... (2 Replies)
Discussion started by: jville
2 Replies

3. UNIX for Dummies Questions & Answers

Vi global replace command

I am wondering what way, I can remove a certain text with nothing. for example: MyVariable=Y7UHNI to only: Y7UHNI removing 'MyVariable=' globally? thanks (1 Reply)
Discussion started by: DallasT
1 Replies

4. Shell Programming and Scripting

Global search and replace multi line file

Hello I need to search for a mult-line strngs(with spaces in between and qoted) in a file1 and replace that text with Fixed string globally in file1. The strng to search for is in file2. The file is big with some 20K records. so speed and effciency is required file1: (where srch & rplc... (0 Replies)
Discussion started by: Hiano
0 Replies

5. Shell Programming and Scripting

Global replace in vi with no escape required

Hi all, I want to replace a string of words but i dont want to worry about escaping the characters in that string . For e.g. If my string is "work/" and i want to replace it with "nowork" .I have to type %s/work\//nowork/g Is there a way by which I wont need to worry about the data in... (1 Reply)
Discussion started by: sachinpawar2308
1 Replies

6. Shell Programming and Scripting

Global search and replace across multiple files

Hi all I'm in need of a command which can replace a specified string with another string - across multiple files within multiple sub-directories (I intend to run it from / ) I've used the following to get a list of the files: find . | xargs grep <string1> But that's as far as I've got.... (7 Replies)
Discussion started by: huskie69
7 Replies

7. UNIX for Dummies Questions & Answers

global search and replacement of a non-ascii character

Hi, I need to do a global search and replacement of a non-ascii character. Let me first give the background of my problem. Very frequently, I need to copy set of references from different sources. Typically, a reference would like this: Banumathy et al., 2002 G. Banumathy, V. Singh and U.... (1 Reply)
Discussion started by: effjay
1 Replies

8. Shell Programming and Scripting

Global replace with sed

Hi, I need to change some strings from A to B in a number of files within a directory. Please can someone advise how do I do that? Many thanks (5 Replies)
Discussion started by: canary
5 Replies

9. Shell Programming and Scripting

Perl: Global Search and replace

I have a file where the rows correspond to individuals and the columns are about 106 variables. Each variable is coded as either ACGT, and "missing" is coded as blank. This is a tab delimited file. I'm trying to replace all blanks (" ") with 0. The simple script I have is only replacing some of the... (3 Replies)
Discussion started by: epi8
3 Replies

10. Shell Programming and Scripting

global replace...

Hi, I have a dir containing many shell scripts. Each of these shell scripts state a database name (always the same), which I need to change to be a new database. grep <database name> * brings back all the lines containing the database name. However, I need to change them to be something... (1 Reply)
Discussion started by: topcat8
1 Replies
Login or Register to Ask a Question
autodia(3pm)						User Contributed Perl Documentation					      autodia(3pm)

NAME
autodia - a perl script using the Autodia modules to create UML Class Diagrams or documents. from code or other data sources. INTRODUCTION
AutoDia takes source files as input and using a handler parses them to create documentation through templates. The handlers allow AutoDia to parse any language by providing a handler and registering in in autodia.pm. The templates allow the output to be heavily customised from Dia XML to simple HTML and seperates the logic of the application from the presentation of the results. AutoDia is written in perl and defaults to the perl handler and file extension matching unless a language is specified using the -l switch. AutoDia requires Template Toolkit and Perl 5. Some handlers and templates may require additional software, for example the Java SDK for the java handler. AutoDia can use GraphViz to generate layout coordinates, and can produce di-graphs (notation for directional graphs) in dot (plain or canonical) and vcg, as well as Dia xml. Helpful information, links and news can be found at the autodia website - http://www.aarontrevena.co.uk/opensource/autodia/ USAGE
"autodia ([-i filename [-p path] ] or [-d directory [-r] ]) [options]" "autodia -i filename : use filename as input" "autodia -i 'filea fileb filec' : use filea, fileb and filec as input" "autodia -i filename -p .. : use ../filename as input file" "autodia -d directoryname : use *.pl/pm in directoryname as input files" "autodia -d 'foo bar quz' : use *pl/pm in directories foo, bar and quz as input files" "autodia -d directory -r : use *pl/pm in directory and its subdirectories as input files" "autodia -d directory -F : use files in directory but only one file per diagram" =item "autodia.pl -d directory -C : use files in directory but skip CVS directories" "autodia -o outfile.xml : use outfile.xml as output file (otherwise uses autodial.out.dia)" "autodia -O : output to stdout" "autodia -l language : parse source as language (ie: C) and look for appropriate filename extensions if also -d" "autodia -t templatefile : use templatefile as template (otherwise uses template.xml)" "autodia -l DBI -i "mysql:test:localhost" -U username -P password : use test database on localhost with username and password as username and password" "autodia -l Mason -i "/index.html" -p comp_root -G '$c' : use HTML::Mason to fetch /index.html from comp_root and show all components in reach. -G corresponds to allow_globals." "autodia -z : output via graphviz" "autodia -Z : output via springgraph" "autodia -v : output via VCG " "autodia -s skipfile : exclude files or packagenames matching those listed in file" c<autodia -D : ignore dependancies (ie do not process or display dependancies)> "autodia -K : do not display packages that are not part of input" "autodia -k : do not display superclasses that are not part of input" "autodia -H : show only Public/Visible methods" "autodia -m : show only Class methods" "autodia -M : do not show Class Methods" "autodia -a : show only Class Attributes" "autodia -A : do not show Class Attributes" "autodia -S : silent mode, no output to stdout except with -O" "autodia -h : display this help message" "autodia -V : display version and copyright message" perl v5.12.4 2011-05-23 autodia(3pm)