Robin Paulson
2011-06-03 04:19:54 UTC
..is apparently rather tricky to master. i have the following
situation, and can't figure out how to solve it:
1. search for files matching a certain pattern in a directory
structure, using 'find'
2. carry out some processing (based on imagemagick's combine function)
on each file in the list, against a file in a similar structure
so, say there are these files:
/home/robin/var1/14/8849.png
/home/robin/var1/14/8850.png
/home/robin/var1/14/8851.png
/home/robin/var1/13/784.png
/home/robin/var1/13/785.png
/home/robin/var1/13/786.png
/home/robin/var1/13/786.png
and, for each file which exists in that list i want to process it
against its matching pair in a similar structure, with the following
locations:
/home/robin/var2/14/8849.png
/home/robin/var2/14/8850.png
/home/robin/var2/14/8851.png
/home/robin/var2/13/784.png
/home/robin/var2/13/785.png
/home/robin/var2/13/786.png
/home/robin/var2/13/786.png
to produce files with these locations:
/home/robin/var3/14/8849.png
/home/robin/var3/14/8850.png
/home/robin/var3/14/8851.png
/home/robin/var3/13/784.png
/home/robin/var3/13/785.png
/home/robin/var3/13/786.png
/home/robin/var3/13/786.png
note: there are far more files in the second list than the first - i
only want to process files which exist in the first list (the presence
in the second list can be assumed true)
so, i start off with:
#find all files in the directory structure (there are only .png files)
for i in 'find /home/robin/var1 -f'
#use the imagemagick combine function to overlay a file in folder var1
on top of folder var2
do combine $i <some sed to get from $i to the corresponding filename in
list 2> <some sed to get from $i to the corresponding filename in list
3>
done
and the sed part has me lost. sed appears to want a file, although it
maybe can accept parameters - i'm not sure. man sed is...well, not much
help
and i think i've explained this really badly....
cheers,
situation, and can't figure out how to solve it:
1. search for files matching a certain pattern in a directory
structure, using 'find'
2. carry out some processing (based on imagemagick's combine function)
on each file in the list, against a file in a similar structure
so, say there are these files:
/home/robin/var1/14/8849.png
/home/robin/var1/14/8850.png
/home/robin/var1/14/8851.png
/home/robin/var1/13/784.png
/home/robin/var1/13/785.png
/home/robin/var1/13/786.png
/home/robin/var1/13/786.png
and, for each file which exists in that list i want to process it
against its matching pair in a similar structure, with the following
locations:
/home/robin/var2/14/8849.png
/home/robin/var2/14/8850.png
/home/robin/var2/14/8851.png
/home/robin/var2/13/784.png
/home/robin/var2/13/785.png
/home/robin/var2/13/786.png
/home/robin/var2/13/786.png
to produce files with these locations:
/home/robin/var3/14/8849.png
/home/robin/var3/14/8850.png
/home/robin/var3/14/8851.png
/home/robin/var3/13/784.png
/home/robin/var3/13/785.png
/home/robin/var3/13/786.png
/home/robin/var3/13/786.png
note: there are far more files in the second list than the first - i
only want to process files which exist in the first list (the presence
in the second list can be assumed true)
so, i start off with:
#find all files in the directory structure (there are only .png files)
for i in 'find /home/robin/var1 -f'
#use the imagemagick combine function to overlay a file in folder var1
on top of folder var2
do combine $i <some sed to get from $i to the corresponding filename in
list 2> <some sed to get from $i to the corresponding filename in list
3>
done
and the sed part has me lost. sed appears to want a file, although it
maybe can accept parameters - i'm not sure. man sed is...well, not much
help
and i think i've explained this really badly....
cheers,
--
robin
http://bumblepuppy.org/blog/?p=237 - government bill to remove basic
human rights in NZ
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
robin
http://bumblepuppy.org/blog/?p=237 - government bill to remove basic
human rights in NZ
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug