copy the content from corrosponding paths from two files

Hi Gurus,
I've two files each with srcpath and destpath. I need to copy files
from each srcpath to its corrosponding destpath.

srcfile

/ms1/test1/test2
/ms2/test4/test5

destfile
/ds1/tst1/tst5
/ds3/tst4/tst6
---

So i need to copy dir from
scp /ms1/test1/test2 /ds1/tst1/tst5
scp /ms2/test4/test5 /ds3/tst4/tst6

Please help.
bhaveshah [ Di, 15 April 2008 22:18 ] [ ID #1942538 ]

Re: copy the content from corrosponding paths from two files

explor wrote:
> Hi Gurus,
> I've two files each with srcpath and destpath. I need to copy files
> from each srcpath to its corrosponding destpath.
>
> srcfile
>
> /ms1/test1/test2
> /ms2/test4/test5
>
> destfile
> /ds1/tst1/tst5
> /ds3/tst4/tst6
> ---
>
> So i need to copy dir from
> scp /ms1/test1/test2 /ds1/tst1/tst5
> scp /ms2/test4/test5 /ds3/tst4/tst6
>
> Please help.


paste srcfile destfile | sed 's/^/cp /' | sh

--
Michael Tosch [at] hp : com
Michael Tosch [ Di, 15 April 2008 23:01 ] [ ID #1942542 ]

Re: copy the content from corrosponding paths from two files

On 2008-04-15, explor <bhaveshah [at] gmail.com> wrote:
> Hi Gurus,
> I've two files each with srcpath and destpath. I need to copy files
> from each srcpath to its corrosponding destpath.
>
> srcfile
>
> /ms1/test1/test2
> /ms2/test4/test5
>
> destfile
> /ds1/tst1/tst5
> /ds3/tst4/tst6
> ---
>
> So i need to copy dir from
> scp /ms1/test1/test2 /ds1/tst1/tst5
> scp /ms2/test4/test5 /ds3/tst4/tst6
>
> Please help.

paste srcfile destfile | xargs -n 2 scp

Or,

paste srcfile destfile | sed 's/^/scp /' | sh

The second might be better; it's less likely to
overwrite files if your input files aren't squared
away.

--
Christopher Mattern

NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities
Chris Mattern [ Di, 15 April 2008 23:43 ] [ ID #1942544 ]

Re: copy the content from corrosponding paths from two files

On Apr 15, 2:43=A0pm, Chris Mattern <sys... [at] sumire.gwu.edu> wrote:
> On 2008-04-15, explor <bhaves... [at] gmail.com> wrote:
>
>
>
>
>
> > Hi Gurus,
> > I've two files each with srcpath and destpath. I need to copy files
> > from each srcpath to its corrosponding destpath.
>
> > srcfile
>
> > /ms1/test1/test2
> > /ms2/test4/test5
>
> > destfile
> > /ds1/tst1/tst5
> > /ds3/tst4/tst6
> > ---
>
> > So i need to copy dir from
> > scp /ms1/test1/test2 /ds1/tst1/tst5
> > scp /ms2/test4/test5 /ds3/tst4/tst6
>
> > Please help.
>
> paste srcfile destfile | xargs -n 2 scp
>
> Or,
>
> paste srcfile destfile | sed 's/^/scp /' | sh
>
> The second might be better; it's less likely to
> overwrite files if your input files aren't squared
> away.
>
> --
> =A0 =A0 =A0 =A0 =A0 =A0 =A0Christopher Mattern
>
> NOTICE
> Thank you for noticing this new notice
> Your noticing it has been noted
> And will be reported to the authorities- Hide quoted text -
>
> - Show quoted text -

Thanks Chris. It worked!!!!!!!
bhaveshah [ Mi, 16 April 2008 18:57 ] [ ID #1943327 ]
Linux » comp.unix.shell » copy the content from corrosponding paths from two files

Vorheriges Thema: Re: Yikes! Where is my prompt config hiding?
Nächstes Thema: Regular expression capture group in shell