Thanks all for the advice. That part of the script is working, but I'm a bit concerned because I don't think I could debug it if something goes wrong. But what could go wrong? Well, now that I have the list of numbers I need to use them to extract lines from various files that are in pipe delimited format.Each number is unique and only appears in one line of the file. The problem is when I run either of the scripts below the result is every single line of the file. set thePattern to "\\|4571100\\||12245332\\||7519636\\||4824164\\||2971399\\||925639\\|| " set myShellScript to "egrep " & quoted form of thePattern & " " & quoted form of programFile set myOutput to do shell script myShellScript set thePattern to "\\|4571100\\||" set myShellScript to "egrep " & quoted form of thePattern & " " & quoted form of programFile set myOutput to do shell script myShellScript Any ideas what I'm doing wrong? ES