cancel
Showing results for 
Search instead for 
Did you mean: 

Shell Script - File Transfer

silentbull
Participant
0 Kudos

Hi

I have a File transfer scenario between two FTPs. While putting the target file into the FTP, I need to change one partcular value inside the file.

Can this be achieved using shell script and if so, can anyone let me know the code for that.

For eg., I need to change a fixed value 5001 into 5020.

Regards

Sam

Accepted Solutions (0)

Answers (1)

Answers (1)

iaki_vila
Active Contributor
0 Kudos

Hi Sam,

Is it in the file content?, if you are on linux this thread can help you text processing - How can I replace a string in a file(s)? - Unix & Linux Stack Exchange

Regards.

silentbull
Participant
0 Kudos

Hello

My Os is AIX.

Regards

Sam

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sam,

              Suppose you have a file text.anu with following lines in it

anupam   tty1         2015-12-01 15:00 (:0)

anupam   pts/2        2015-12-01 18:52 (:0.0)

Now I write a script change.sh with following line in it

sed -i 's/anupam/India/g' *.anu

here

anupam ---- word to be replaced

India -----------new word to replace

output of the file text.anu after I execute the script is

text.anu

------------

India   tty1         2015-12-01 15:00 (:0)

India   pts/2        2015-12-01 18:52 (:0.0)

In your case the line in the script will be (for csv file)

sed -i 's/5001/5020/g' *.csv

Regards

Anupam

iaki_vila
Active Contributor
0 Kudos

Hi Sam,

Check this blog Replacing a string in multiple files in AIX — perl vs. sed | db2talk</title><link..., i am not expert in AIX but reading the blog i think it adjusts to your requirement.

Regards.