Grep output to variable list

I’m writing a backup helper program, which will copy folders on a remote location to a backup folder, but only if the order number in the folder name matches the ones in the backup list (another folder with folders).

To get a list of numbers from the backup list i wrote the following script:


do shell script "ls /Volumes/ripro2-C/Systeembeheer%0/"Nog opschonen m.b.t. Litho's"/ | grep "^[0-9]\{7\}" | sed s/" .*"//g | sed s\/"_.*"//g | grep "^[0-9]\{7\}$""

which returns a list of numbers like this:

“3306353
3307105
3400424
3400757
3400798
3400929”

But what i need is this :

{“3306353”, “3307105”, “3400424”, “3400757”, “3400798”, “3400929”, “3401359”, “3401512”, “3401803”, “3401889”, “3401901”}

How do i do this???

This should work:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

It works, Thanks.

I also found another way, but yours is a bit cleaner:


do shell script "ls /Volumes/ripro2-C/Systeembeheer%0/"Nog opschonen m.b.t. Litho's"/ | grep "^[0-9]\{7\}" | sed s/"[_ ].*"//g | grep "^[0-9]\{7\}$""
set the_list to every word of (result as string)

Applescript rocks even more with a dash of *nix.

I Finished the script today, and it’s gonna save me a lot of work!! :lol: