On OS 10.4.11
I have filenames like:
670711 SA T2 v1-1_DS_EF.doc
CT_670520 AM T1 v1-2_DS_EF.doc
CT_670716 - 2 SA T4 v1-2_DS_EF.doc
CT_670713 SA T3 v1-1_DS_EF.doc
670421 PA DYP1 v1-1_DS_EF.doc
CT_670425 PA DYP2 v1-1_DS_EF.doc
CT_670107 RA T3 v1-2_DS_EF.doc
CT_670521 AM T2 v1-2_DS_EF.doc
CT_670718-1 SA T5 v1-2_DS_EF.doc
I want extract the substrings in bold and assign to a variable.
I'm trying this:
datedid=`echo $tname | sed 's/\([[:digit:]]\{6\}[-]?[[:digit:]]?\)/\1/'`
But this simply returns $tname unaffected.
I have also tried:
datedid=`echo $tname | sed -E 's/\([[:digit:]]\{6\}[-]?[[:digit:]]?\)/\1/'`
But gives and error that "\1 not defined in the RE".
Have spent the morning googling and reading, but missing something here...Any sed gurus out there?