on 12-01-2015 9:01 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Hi Sam,
Check this blog Replacing a string in multiple files in AIX &#8212; perl vs. sed | db2talk</title><link..., i am not expert in AIX but reading the blog i think it adjusts to your requirement.
Regards.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.