I have a file, FileToCopy.pbs
, that I would like to copy into multiple directories while changing a line called xxx
in the file to the pwd
location of the directory in which the file is to be copied.
What kind of for loop can I use to make this command?
Also, some of my directories include a *
at the end of the directory path name.
More specifically I have a directory structure:
/home/path1/dir1
/home/path1/dir2
/home/path1/dir3*
/home/path1/dir4*
.
.
etc
and would like to copy FileToCopy.pbs
into all directories so that I have:
/home/path1/dir1/FileToCopy.pbs
/home/path1/dir2/FileToCopy.pbs
/home/path1/dir3*/FileToCopy.pbs
/home/path1/dir4*/FileToCopy.pbs
while changing a line xxx
in each copied file of FileToCopy.pbs
to the directory in which it is in. For instance, the line xxx
for the FileToCopy.pbs
located in /home/path1/dir1/
should be changed to /home/path1/dir1/
Thank you.