I have a log file that has lines that look like this:blah blah blah Photo for (702049679 - blah blah blahNow I know I could get all the lines like that from the file by doing:grep Photo for logFileBut how can I take those lines and get a comma seperated list of each number after the parenthesis in a single output line (these are going to be pasted into an SQL query)?The numbers in question will be the first occurrence of a string of numeric characters 9 or more digits long.  Ideally it could be matched using that criteria, or the criteria of the first number occurring after the Photo for ( text.
Awk/grep/sed get comma separated list of numbers from lines of text
command line;sed;grep;awk
A regex this complicated is better handled with Perl, e.g.grep Photo for logFile | perl -pe 's/.*Photo for ((\d+).*/\1/' | tr '\n' ','If Perl is out of the question:grep Photo for logFile | awk '{sub(/.*Photo for \(/,,$0);sub(/[ ].*/,);print $0}' | tr '\n' ','