Need help with sed or awk and regular expressions

inode0 inode0 at gmail.com
Sat Jul 2 03:27:16 UTC 2005


On 7/1/05, inode0 <inode0 at gmail.com> wrote:
> $ echo $FOO
> 44.MR3M01J.AF_TBL_COL_1.2005-06-30.DAT
> $ echo ${FOO//+(44.MR3M01J.|_[12]*[0-9-])}
> AF_TBL_COL.DAT

Ack! That last hypen is leftover harmless cruft. All one needs is

$ echo ${FOO//+(44.MR3M01J.|_[12]*[0-9])}
AF_TBL_COL.DAT

My first iteration was

$ echo ${FOO//+(44.MR3M01J.|_[12].*([0-9-]))}
AF_TBL_COL.DAT

which may be a more clear expression to match the second part of the
string to delete.
Regular expressions give just about everyone a headache. :)

John




More information about the Redhat-install-list mailing list