Sponsored Content
Top Forums Shell Programming and Scripting search and replace in many files Post 302386470 by guessingo on Tuesday 12th of January 2010 01:31:56 PM
Old 01-12-2010
search and replace in many files

I have a directory full of files. Most of the code in the files is the same accept for a few parameter values. I want to remove hard coded values and replace it with a parameter that I can pass. This is oracle pl/sql anonymous blocks. so the code is similiar to this

Code:
function myfunc 
(p_myvar  in varchar2)
return is
 
 myvar2 varchar2(100) := 'HELLO';
end;

I want to do 2 things.

1. change the line with p_myvar to

Code:
p_myvar in varchar2, p_myvar2 in varchar2)

and change

Code:
myvar2 varchar2(100) := 'HELLO';

to

Code:
myvar2 := p_myvar2;

This is code I am cleaning up. It is just alot of files to change. I am hope I can do this quickly with SED or something like that and its easier than doing this all manually.

Last edited by pludi; 01-12-2010 at 04:44 PM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

fast search and replace in all files

Hi I need to find one string in all files and replace tht string with blank space and need to redirect all the files into the same directory again. now i am using find ./ -name "*.dmp" | xargs perl -pi -e 's/\\N//g' | sed 's/.$//g' but now its not redirrecting properly . its taking... (21 Replies)
Discussion started by: dbsurf
21 Replies

2. Shell Programming and Scripting

Search and Replace between two files

Hi all- I've got 2 files: One is the final results and one is a result set from a query. In the final results files I have placeholder strings in there that need to be replaced by the corresponding strings from the query file. So File#1 (FINAL RESULTS) LINEID CLIENT ID REP ... (1 Reply)
Discussion started by: Cailet
1 Replies

3. Shell Programming and Scripting

Search and replace text in many files

Hello, I am very new to Linux and am trying to find a way for following problem. I have a number of files in a folder as Export000.dat, Export001.dat ..and so on. Each file has a string field 'Absolute velocity'. I want it to be replaced by 'Pixel shift' in all the files. I tried something like... (4 Replies)
Discussion started by: chirag.joshi
4 Replies

4. Shell Programming and Scripting

Search and replace string in files

I'm trying to remove the following string from several files. <img heigth="1" width="1" border="0" src="http://myteenmovies.net/t.php?id=5540372">I'm using the following script #!/bin/bash # This script will search and replace all regular files for a string # supplied by the user and... (1 Reply)
Discussion started by: d13g0sv
1 Replies

5. UNIX for Dummies Questions & Answers

Search and replace across files

Hi All, HP-UX oradev3 B.11.11 U 9000/800 3251073457 I have following files all contains text like "919642990137@". I need to search this text across all files and replace it with something like "919717298765@". I was wondering, how to accomplish this task? cpmprod_status.sh... (8 Replies)
Discussion started by: alok.behria
8 Replies

6. Programming

Search and replace in two different files

Hi there, i got the following problem. i need a bash script to correct e-mail addresses in an csv. i got a huge csv like this A B C D heiner.holber.somewhere.ch heiner holber heiner.holber@somewhere.ch So A is the wrong... (8 Replies)
Discussion started by: molker
8 Replies

7. Shell Programming and Scripting

Keyword search/replace for two text files?

What is the best way (bash/awk/sed?) to read in two text files and do a keyword search/replace? file1.txt: San Francisco Los Angeles Seattle Dallas file2.txt: I love Los Angeles. Coming to Dallas was the right choice. San Francisco is fun. Go to Seattle in the summer. ... (3 Replies)
Discussion started by: pxalpine
3 Replies

8. Shell Programming and Scripting

Search and Replace in multiple files

Hello, I have hundreds of files in which I need to change email address. Here is what I am trying to do: 1. All text files are in a directory "a" 2. In the text file, I want to replace email address for preparer. All these lines start with {{PreparerEmail and end with }}. The email... (3 Replies)
Discussion started by: cartrider
3 Replies

9. Shell Programming and Scripting

Search replace with awk using 2 files

I have a bit of a complex problem that I would like to solve with awk. It is essentially a 2-part problem. I have a large directory of files with the same format, each with 266 lines. The first 206 lines of each file are filled with attribute information. Then the following 60 lines consist... (4 Replies)
Discussion started by: owwow14
4 Replies

10. UNIX for Dummies Questions & Answers

Search in one type of files and replace

I am not sure how to search and replace the word in the few specific files. I need to search and replace word in only the name containing pepsi in the filename. (12 Replies)
Discussion started by: ramkumar15
12 Replies
ch_rc(1M)																 ch_rc(1M)

NAME
ch_rc - change system configuration file SYNOPSIS
root] {parameter|parameter=value}...] [file...] DESCRIPTION
manages the addition, modification, removal, and retrieval of information stored in files having the format of those in the directory. Parameter names are treated as strings. Thus, has no special meaning to in relation to other parameters named Options file Specify the file(s) to be used as the configuration database. If no file is specified, the set of files used by defaults to and all files in the directory. Modification and deletion of configuration parameters occurs in the file where the parameter is found. Add or modify a parameter definition. For each parameter specified on the command line, if the parameter is found in the specified (or default) files, it is modified to reflect the speci- fied value. If the parameter is not found, it is added to the specified file(s). If a new parameter is being defined, one or more files must be specified on the command line; the specified files are those in which the parameter will be defined. Remove a parameter definition. For each parameter name specified on the command line, remove any occurrence of that parameter from the specified file(s). List configuration values. For each parameter specified on the command line, output every definition of the parameter from the specified file(s). Output consists of only the values, one per line. Specify a parameter name or name/value pair. If a name and value is expected, but only a name is specified, the value will be set to the empty string. For example, specifying or will result in and respectively. Due to shell quoting rules, if you need a quoted parameter value, you must protect the quotes from the shell. For exam- ple, yields: which is an error, whereas, yields: Verbose. When used with the option, the option causes a verbose listing to be output. This listing includes a filename followed by the entire line containing the specified parameter for each occurrance of the parameter. The option is used to list all occurances of array parameters matching the parameters specified on the command line. For example, may emit the following output: Normally, the files specified on the command line are used as specified. By specifying a root directory with the option, all files (including the default files if none are specified) will be interpreted relative to root. For example, if root is specified as and is specified on the command line, it will be interpreted as RETURN VALUE
exits with one of the following values: 0 add/delete/list successful 1 command line syntax/usage error 2 can not access one or more of the listed (or default) files 3 can not open/create/write file 4 memory error 5 no files specified on command line for add option EXAMPLES
Files in the directory have the following format: WARNINGS
does not interpret configuration files; it only does pattern matching. As a result, if comments appear on lines containing parameter defi- nitions, the comments will also appear in output when using the option. cannot parse multiple parameter definitions which occur on the same line of a file. AUTHOR
was developed by HP. FILES
system configuration database driver file directory containing system configuration files SEE ALSO
rc.config(4). ch_rc(1M)
All times are GMT -4. The time now is 04:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy