Sponsored Content
Top Forums Shell Programming and Scripting How to make the same change in multiple shell scripts? Post 26064 by jiin on Saturday 10th of August 2002 10:18:27 PM
Old 08-10-2002
If I understand you correctly you want to change one specific regex in a script to another. you can use sed to do global substitutions.

sed -e s/foo/bar

Build a list file with
ls > listfile and edit it. Then:

listfile=/path/to/listfile
for i in $listfile
do
sed -e s/foo/bar $i
done
echo Return Code: $?


The echo at the bottom will return a 0 or a 1 .. 0 if successfull and 1 if it fails.

jiin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Manipulating a variable across multiple shell scripts

I have a shell script similar to: #!/bin/sh a=1 source a1.sh -- Modifies a source a2.sh -- Modifies a echo "After execution, value of a is $a" What i need is a1.sh script modify the same variable a and same with a2.sh. Now the echo "After execution, value of a is $a" should print the... (1 Reply)
Discussion started by: indianjassi
1 Replies

2. Shell Programming and Scripting

shell scripting-processing multiple scripts

I have four scripts to run. My 1st script will make script2 and script3 to run. I am setting a cron job for this script1 to run continuously. This script1 will check for 2 text files and based on the existance of those text files it will initiate the script2 and script3. Now my doubt is that... (2 Replies)
Discussion started by: RSC1985
2 Replies

3. UNIX for Dummies Questions & Answers

Use of grep with multiple parameters in shell scripts

I am learning how to write shell scripts and have come across an issue. I'm trying to write a script that looks for a directory called public_html, and if it finds one, to print the number of lines that contain applet tags (containing '<applet') in all files that end in either .html or .htm that... (7 Replies)
Discussion started by: feverdream
7 Replies

4. UNIX and Linux Applications

how to execute multiple .sql scripts from within a shell script using sqlplus

using sqlplus I want to execute a .sql script that has dbms_output statments in rhe script. I want to write the dbms_output statements from .sql file to a log file. is this possible. thanks any help would be appreciated :wall: (1 Reply)
Discussion started by: TRS80
1 Replies

5. Shell Programming and Scripting

Find and execute shell scripts in multiple sub directories in parallel

I have one parent directory and within that parent directory there are several other sub-directories and within those sub-directories there are several other "large number" of sub-directories. All the sub directories have a shell script in them with a common file name execute_command.sh I want... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

6. Shell Programming and Scripting

Help with Shell Scripts Using sed in multiple files.

Hi, I was hoping that someone could help me. I have a problem that i am trying to work on and it requires me to change text within multiple files using sed. I use the program to change an occurance of a word throughout different files that are being tested. At first i had to Create a new script,... (1 Reply)
Discussion started by: Johnny2518
1 Replies

7. Homework & Coursework Questions

Help with Shell Scripts Using sed in multiple files.

Hi, I was hoping that someone could help me. I have a problem that i am trying to work on and it requires me to change text within multiple files using sed. What i have so far is !/bin/sh File1="$3" File2="$4" File3="$5" testNum="$File1" while test "$testNum" <= "$File3"; do echo... (12 Replies)
Discussion started by: Johnny2518
12 Replies

8. Shell Programming and Scripting

Can anybody change this into Linux shell scripts?

@echo off SET "p0=%~0" SET "p1=%~1" SET "p2=%~2" SET "p3=%~3" SET "p4=%~4" SET "p5=%~5" SET "p6=%~6" SET "p7=%~7" SET "p8=%~8" SET "p9=%~9" SHIFT SET "p10=%~9" SHIFT SET "p11=%~9" SET "zip_path=D:\OraOutput\interco\%p10%" echo Program... (5 Replies)
Discussion started by: monisha
5 Replies

9. Shell Programming and Scripting

Multiple shell scripts executed in one script

Hi every one, i am new to shell script. my people given a task to write a shell script that should execute number of shell scripts in that. in that, if any shell script is failed to execute, we have to run the main script again, but the script should start execute from the failed script only.. it... (1 Reply)
Discussion started by: Madhu Siddula
1 Replies

10. Shell Programming and Scripting

Multiple shell scripts executed in one script

Hi every one, i am new to shell script. my people given a task to write a shell script that should execute number of shell scripts in that. in that, if any shell script is failed to execute, we have to run the main script again, but the script should start execute from the failed script only.. it... (6 Replies)
Discussion started by: Madhu Siddula
6 Replies
GET_CLASS(3)								 1							      GET_CLASS(3)

get_class - Returns the name of the class of an object

SYNOPSIS
string get_class NULL ([object $object]) DESCRIPTION
Gets the name of the class of the given $object. PARAMETERS
o $object - The tested object. This parameter may be omitted when inside a class. RETURN VALUES
Returns the name of the class of which $object is an instance. Returns FALSE if $object is not an object. If $object is omitted when inside a class, the name of that class is returned. ERRORS
/EXCEPTIONS If get_class(3) is called with anything other than an object, an E_WARNING level error is raised. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | | | | NULL became the default value for $object, so | | | passing NULL to $object now has the same result | | | as not passing any value. | | | | | 5.0.0 | | | | | | | The class name is returned in its original nota- | | | tion. | | | | | 5.0.0 | | | | | | | The $object parameter is optional if called from | | | the object's method. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 Using get_class(3) <?php class foo { function name() { echo "My name is " , get_class($this) , " "; } } // create an object $bar = new foo(); // external call echo "Its name is " , get_class($bar) , " "; // internal call $bar->name(); ?> The above example will output: Its name is foo My name is foo Example #2 Using get_class(3) in superclass <?php abstract class bar { public function __construct() { var_dump(get_class($this)); var_dump(get_class()); } } class foo extends bar { } new foo; ?> The above example will output: string(3) "foo" string(3) "bar" SEE ALSO
get_called_class(3), get_parent_class(3), gettype(3), is_subclass_of(3). PHP Documentation Group GET_CLASS(3)
All times are GMT -4. The time now is 12:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy