Multiple rename part of scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Multiple rename part of scripts
# 1  
Old 11-19-2009
CPU & Memory Multiple rename part of scripts

i have about 30 scripts for example:

test, test1,test2, test3, test4,.....

inside every scripte is code like this:

Code:
echo "input check OK"

how to rename this line in multiple scripts in this:

Code:
echo "input error!"

# 2  
Old 11-19-2009
try:

Code:
perl -i -ne 's/check OK/error!/g;print;' test*

# 3  
Old 11-19-2009
Below should do:
Code:
sed 's|check OK|error!|g' 

or

awk '{gsub("check OK","error!");print}'

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to rename last part of file ?

Hi, I have large number of files like below - UNIX FY17 D21-1c Active user audit - NPP dir owner listing(vctmstt01)_072816 - Notepad.pdf UNIX FY17 D21-1c Active user audit - TTMS dir owner listing(pvcdmot35)_072816 - Notepad.pdf UNIX FY17 D21-1c Active user audit - PCP dir owner... (3 Replies)
Discussion started by: solaris_1977
3 Replies

2. Shell Programming and Scripting

Find and rename part of a file

hi, Need your help. I need to write a script for below.. i have two files in directory /home/abc as below: Watch_20140203_abc.dat Watchnow_20140203_abc.dat I have to copy this file from /home/abc to /home01/home02 after that i have to rename the date part in above two files... (1 Reply)
Discussion started by: Vivekit82
1 Replies

3. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

4. UNIX for Dummies Questions & Answers

Rename scripts using xargs/sed

Morning all I've got loads of scripts but the names are too long! I've stuck the list in a flat file (names) and I'm trying to read that in line by line and create the new names (in to directory new) from the list. It looks like this: xargs -n1 -I{} <names cat {} | sed... (1 Reply)
Discussion started by: Grueben
1 Replies

5. UNIX for Dummies Questions & Answers

Multiple file rename

hi im new to linux and was just wondering if some 1 could help me i have folders with T.V. series in them and i would like to delete part of the filename e.g. (series name).s01e01.(episode name) (series name).s01e02.(episode name) (series name).s01e03.(episode name) (series... (4 Replies)
Discussion started by: stevemcd1990
4 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Rename file name / remove part of name

I have a whole file structure with jpeg files where I want to remove a part of the file name. An application added in many files a case conflict in the naming "xyz 017.jpg (Case Conflict 1)" So, can someone help me how to get rid of the " (Case Conflict 1)"? What I have is this: find . -name... (2 Replies)
Discussion started by: borobudur
2 Replies

7. Shell Programming and Scripting

Any shell scripts for cutting and pasting part of data?

Hi, I have a tab-delimited txt file as below. It is part of the original file. I want to cut the lines starting with "3" in column1 and paste them before the lines starting with "1" in column 1. So I will get Anyone knows any simple shell scripts to do that? The original file is... (5 Replies)
Discussion started by: cliffyiu
5 Replies

8. UNIX for Dummies Questions & Answers

Help with multiple file rename - change case of part of file name

Hi there, I hope someone can help me with this problem : I have a directory (/var/www/file/imgprofil) which contains about 10000 JPG files. They have a naming convention thus : prefix-date-key-suffix.jpg they all have the prefix p-20050608- then AAAA is a 4 letter code the suffix is... (7 Replies)
Discussion started by: steve7
7 Replies

9. Shell Programming and Scripting

Rename part of multiple files

Hello, I have about 200 files named like script1234_test.sh script3434_test.sh and so on... I am trying to write a script that will rename those files from test to dev, keeping the rest of the file name intact. Could anyone help? Thanks. (4 Replies)
Discussion started by: sajjad02
4 Replies
Login or Register to Ask a Question