Oh, and you can get the other end next by

foo2=`echo '123--bad-2xyz-3--' | sed -r -e "s/$foo//"`
echo $foo2
-2xyz-3--

Joseph Davis wrote:
I'd use sed and the regex "-[0-9]" to delimit the field


foo=`echo '123--bad-2xyz-3--' | sed -r -e "s/-[0-9].*//"`
echo $foo
123--bad


Helpful?

Adam Carter wrote:
Hi All,

I need to cut a string, which happens to be a filename, using the
first dash that's followed by a numeral, so cut -f 1 -d"-" fails if
the filename has an extra dash. How do i do this?




--
University of Houston, Cougar Card services support.

Reply via email to