How to transfer files between two server after finding.
Hello experts,
I want to search for 1 file (say test.txt) on first server and all the output of this search to be greped as per my requirement and then transfered on the second server at the same location where they were on first server. for eg, output of search of file (test.txt) >> output.txt /tmp/test.txt /home/cpan/test.txt /opt/cpanel/test.txt Now I want to grep this output to only related to cpanel, for f in `cat output.txt` echo $f | grep "cpanel" if [ $? -eq 0 ] then do scp. But I am bit confused here, as in how to use scp command here. scp $f root@second_server:/$f ? Is this right? This doesnt seem to working. Please advise. Regards Monika |
See if something like this will work for your needs:
Code:
#!/bin/bash |
Quote:
Code:
grep cpanel output.txt| while read file |
thanks this worked :)
Code:
do |
All times are GMT -5. The time now is 01:47 PM. |