hi
i have a list of directory in a text file with all directories name in a column.(this is not exactly a file but i need to do a grep and awk on a file to find that list)
i have the source folders like
abchome/abc/xxyz/nl_xxabc/mm/[directories list to pick up from a file]/ v01
abchome/abc/xxyz/nl_xxabc/mm_new/[directories list to pick up from a file]/ v01
abchome/abc/xxyz/nl_xxabc/mm_old/[directories list to pick up from a file]/ v01
out of 5 versions i need to move two versions.Lets say v03 and v05.
destination directories
abcprojs/abc/projs/mm/[directories similar to the list in that file]/
WHAT I WANT IS TO MOVE THE V01 TYPE OF DIRECTORIES FROM THE SOURCE TO DESTINATION BY A SHELL SCRIPT..
aNY HELP WOULD BE APPRECIATED..
really need some detail answer..
How about this (remove the echo when your sure it's doing what you want):
while read subdir
do
for v in v03 v05
do
for m in mm mm_new mm_old
do
[ -d abchome/abc/xxyz/nl_xxabc/$m/$subdir/$v ] &&
[ -d abcprojs/abc/mm/$subdir ] &&
echo mv abchome/abc/xxyz/nl_xxabc/$m/$subdir/$v abcprojs/abc/mm/$subdir/
done
done
done < dirlist.txt
Thanx for the replay
This is almost all what i need
but one thing i want to know..
as i already mention i need a grep and awk to find the directory list.
but i dont wantto use a file in between.
i have to put the standard output of this grep and awk to be put as input to the sctipt.
As you mentiond
done < dirlist.txt
in the last line..
This pattern generate the directory list
grep -v = $LLLTT/profile | awk '{print $1}'
how can i do this..?
Like this:
grep -v = $LLLTT/profile | while read subdir junk
do
for v in v03 v05
do
for m in mm mm_new mm_old
do
[ -d abchome/abc/xxyz/nl_xxabc/$m/$subdir/$v ] &&
[ -d abcprojs/abc/mm/$subdir ] &&
echo mv abchome/abc/xxyz/nl_xxabc/$m/$subdir/$v abcprojs/abc/mm/$subdir/
done
done
done
:wall:its not working :wall: