Script to update data in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to update data in a file
# 1  
Old 08-22-2013
Script to update data in a file

Hi,

I need a script to update a line in a file with a file name everytime it runs.

For example

Code:
 
below are two files each files contains two rows(say 4&5) which needs to be updated with a file name
abc.param
xyz.param
Now below are two filenames which have date and time appended to it as below when it get generated. 
test1_20130819101416.dat.Z
test2_20130819094443.dat.Z

Now I want a script which can update two rows of file abc.param with the file name test1_20130819101416.dat.Z.
Also two rows of file xyz.param with filename test2_20130819094443.dat.Z

Please help. Many thanks in advance
# 2  
Old 08-22-2013
Not clear. Please post sample of two .param files and a desired output. How are the filenames supplied (variable, file, array)? What shell are you using?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

In PErl script: need to read the data one file and generate multiple files based on the data

We have the data looks like below in a log file. I want to generat files based on the string between two hash(#) symbol like below Source: #ext1#test1.tale2 drop #ext1#test11.tale21 drop #ext1#test123.tale21 drop #ext2#test1.tale21 drop #ext2#test12.tale21 drop #ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies

2. Shell Programming and Scripting

Update a file with other file data

Gents, Can you help please. Using information from file1, I will like to update file2. file1 X 2922 1581L 30535.00 51881.001 1 3241 30540.00 51666.00 52312.001 X 2922 8931L 30961.00 52625.001 1 4321 30540.00 52194.00 53056.001 X 2922 1711L 30529.00 ... (2 Replies)
Discussion started by: jiam912
2 Replies

3. UNIX for Dummies Questions & Answers

Select last update data based on file name

Hi All, I need to remove all files except the most update data based on date on filename Input data_AIDS_20150312.txt data_AIDS_20150311.txt data_AIDS_20150411.txt data_AIDS_20140312.txt the most updated data is data_AIDS_20150411.txt, so I'll remove other files. My expected output... (3 Replies)
Discussion started by: radius
3 Replies

4. Shell Programming and Scripting

Script need to do update xml file

<avp name="CC-Request-Type" value="1"> </avp> <avp name="CC-Request-Number" value="0"> </avp> <avp name="Subscription-Id"> <avp name="Subscription-Id-Type" value="0"></avp> <avp name="Subscription-Id-Data" value="4081234567"></avp> </avp> <avp... (5 Replies)
Discussion started by: gstar
5 Replies

5. Shell Programming and Scripting

Shell script to update zone file

Hi folks, I have zone files at below path i want to modify their name i don't know how to do it, Can some can suggest some kind line technique. I give you detail I have domain ibphello.com host at ip address 10.2.2.1 and 50 plus domain are there /var/named/*.db. If i want to change... (0 Replies)
Discussion started by: learnbash
0 Replies

6. Shell Programming and Scripting

How to update an entry of another file in a Shell script?

Hi all, Say I have a shell script called update_password.sh - in this script I want to perform a task to update a specified entry of another file (e.g. users.passpords) update_password.sh #!/bin/bash -e PW_FILE_DIR="${A_DIR}/.../..." PW_FILE="users.passwords" I want to update the... (2 Replies)
Discussion started by: isaacniu
2 Replies

7. Shell Programming and Scripting

perl script to update a xml file

Hi experts, I have a set of xml files in folder which has the below field. <mm:sessionID>157.235.206.12900397BE4:A</mm:sessionID>, I need to update this field regularly with new session id, which I have it from a login file. Can anyone tell me how to add a new value in <mm:sessionID>... (3 Replies)
Discussion started by: amvarma77
3 Replies

8. UNIX for Dummies Questions & Answers

update records in a file using shell script...

Hi, I have a file with 6 columns. First 3 columns together make unique record. I have a variable ($v) which hold a value that is obtained by a caliculaion. I have to replace value in 5th columnn with the value of the variable ($v). The value $v is caliculated from col4 and col6 values. ... (2 Replies)
Discussion started by: new_learner
2 Replies

9. Shell Programming and Scripting

update file contents using shell script

Hi, I am having a file which contains as below Names(aaaa ,bbbb ,cccc ,dddd) now i want the file to be updated with new value 'eeee' as below Names(aaaa ,bbbb ,cccc ,dddd ,eeee) Is there a way to script this ? Thanks, (5 Replies)
Discussion started by: drams
5 Replies

10. Shell Programming and Scripting

script to update gecos in passwd file

Hello, I need to add information in the gecos of each login in the passwd file. I have expect installed. I thought about using expect to to read a file with the login names and the gecos information and then execute the command passwd with the -f option. The other option would be to read... (1 Reply)
Discussion started by: jyoung
1 Replies
Login or Register to Ask a Question