Finding/replacing strings in some files based on a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding/replacing strings in some files based on a file
# 8  
Old 07-12-2012
I'm sorry to grab the topic out but i really I need your help. I wanted to post a question in the forum but i am only like 15 minutes new user here. Here is the problem.

I have a script that has been running in my local account since 2011 with no problems.
Then few days back my whole script folder was missing. Our IT advised me it cannot
be restored so I tried to restore my backup and it was successful.

With the accidental removal I asked them to have the script and cronjob owned and executed by the root so that the folder and files are protected from any deletion ( Im using common account).

OK here is the problem. The IT brought the script to their account and cronjob also with
no problems. The next day, other users were complaining they have missing files in their login accounts.

IT blamed the culprit: Cronjob execution of my script caused the missing files from other folders and accounts.

My Home Account : MSLP1

Others (MSLP2/MSLP3/MSLP4) I have no access.

Here is the code. header Pls. help me review and tell myself that what I did was to specifically delete a file from a specific folder. I was hoping that I did not cause the files to get deleted from other accounts or folders as what our IT have advised.


variable declarations:

set scr = /export/home1/MSLP1/engg_data/SDCHECK
set tmp = $scr/temp


Code that caused the deletion when ran in root account.


find $tmp/tmpver -mtime +1 -exec rm -f {} \; >& /dev/null


Where: tmpver is a textfile I wanted to validate and delet if older than 1 day.


I really hope you can reply to me so I can sleep properly not thinking I caused trouble to my work.
# 9  
Old 07-12-2012
This has nothing to do with this topic and you should open a sepparate topic for your question.
However, i'm waiting for help for my previous post.

Thanks
# 10  
Old 07-15-2012
list the file
capture 2nd column

---------- Post updated at 11:00 AM ---------- Previous update was at 10:57 AM ----------

then replace it to first column
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Finding similar strings between two files

Hi, I have a file1 like this: ABAT ABCA1 ABCC1 ABCC5 ABCC8 ABCE1 ABHD2 ABL1 CAMTA1 ACBD3 ACCN1 And I have a second file like this: chr19 46118590 46119564 MACS_peak_1499 3100.00 chr19 46122009 46148405 CYP2B7P1 -2445 chr1 7430312 7430990... (7 Replies)
Discussion started by: a_bahreini
7 Replies

2. Shell Programming and Scripting

Replacing strings in various files

i'm trying to figure out the easiest way to replace a string: pineapple pineapple-reg basketball basketball-reg football foot-reg-ball i'm storing the above in a file called wordstoreplace.txt for each line above, the word in the first column is to be replaced by the word in the second... (4 Replies)
Discussion started by: SkySmart
4 Replies

3. Shell Programming and Scripting

Finding a text in files & replacing it with unique strings

Hallo Everyone. I have to admit I'm shell scripting illiterate . I need to find certain strings in several text files and replace each of the string by unique & corresponding text. I prepared a csv file with 3 columns: <filename>;<old_pattern>;<new_pattern> ... (5 Replies)
Discussion started by: gordom
5 Replies

4. Shell Programming and Scripting

Finding a format in a file and replacing it

Hi, I need help in the following: I have a file in directory with mutiple comma seperated values. One of the value is a date and time format like 2012-04-10 xx:yy:zz I need to find that time format in the file and then replace it with xx:yy+1:zz and then save it as a new file and copy it to a... (3 Replies)
Discussion started by: rabh
3 Replies

5. Shell Programming and Scripting

Extended replacing of nonspecific strings in text files [beware complicated !]

Well, to make another post at this helpful forum :b::D: I recently tried something like this, I want to replace all those numberings/letters that are located between <string>file://localhost/var/mobile/Applications/ and /Documents/</string> numberings =---- replace with: first... (6 Replies)
Discussion started by: pasc
6 Replies

6. Shell Programming and Scripting

Help with Awk finding and replacing a field based on a condition

Hi everybody, I'm trying to replace the $98 field with "T" if the last field (108th) is T I've tried awk 'BEGIN{OFS=FS="|"} {if ($108=="T")sub($98,"T"); print}' test.txt but that doesn't do anything also tried awk 'BEGIN{OFS=FS="|"}{ /*T.$/ sub($98,"T")} { print}' test.txt but... (2 Replies)
Discussion started by: jghi123
2 Replies

7. Shell Programming and Scripting

Replacing Strings in a File

I have a input file which looks like this: Value1="" Value2="" Value3="" ListOfValues=" $Value1 $Value2 $Value3" I have another program which computes the values ($val1, $val2, $val3). So if $val1 is 'A', $val2 is 'B' and $val3 is 'C', I should edit the input file so it will look like:... (6 Replies)
Discussion started by: laiko
6 Replies

8. Shell Programming and Scripting

Replacing Strings in a File

I have a input file which looks like this: Value1="" Value2="" Value3="" ListOfValues=" $Value1 $Value2 $Value3" I have another program which computes the values ($val1, $val2, $val3). So if $val1 is 'A', $val2 is 'B' and $val3 is 'C', I should edit the input file so it will look like:... (0 Replies)
Discussion started by: laiko
0 Replies

9. Shell Programming and Scripting

Replacing strings in csv file.

Hi, I have a problem.. 1) I have a file that contains the lines as below : VRF-TM_DummyLab/mse02.lab,mse02.lab,ge-2/0/7.222 VRF-EMS_HUAWEI_MSAN_208/mse01.lab,mse01.lab,xe-1/0/0.208 2) I need a method to read this file, line by line from :... (5 Replies)
Discussion started by: msafwan82
5 Replies

10. Shell Programming and Scripting

replacing strings with text from other file

Hi, Im trying to update some properties files with text from another file: file1 user=xyz file2 user= after script file2 user=xyz Im using this reading the $QUARTZURL,ETC... from quartz.properties: echo... (1 Reply)
Discussion started by: mc1392
1 Replies
Login or Register to Ask a Question