Here's what I am trying to do: I have a directory full of files. They are all image files and are numbered using an id number, and underscore, and a detail number. Example:
for item 123456, there may be from 0 to 25 images with names such as '123456_0.JPG' or '123456_47.JPG' I need to collect the names of these files and then convert it into one variable that I can then write into a database. My ideal example for the above would be'123456_0.JPG,123456_47.JPG' I can do this with a few id numbers using php, but I need to do this with thousands of id numbers on a daily basis using a cron job I can successully build an array of the filenames using: declare -a imagelist='ls www/images/124534_*.JPG'; But then I am stuck with the problem of srtipping the 'www/images/' off of each array element. I am trying: for file in [EMAIL PROTECTED] do declare newfile=echo $file | sed 's/www\/images\///g' echo $newfile done; But it is not working properly. Any ideas? Once this step is figured out, how do I go about adding the filenames together, delimited with a comma? Any nudging int eh right direction would be appreciated! -- View this message in context: http://www.nabble.com/converting-an-array-into-a-single-variable-tp15596500p15596500.html Sent from the Gnu - Bash mailing list archive at Nabble.com.