Need help with sed or awk and regular expressions

Michael Ault mikerault at yahoo.com
Sat Jul 2 15:42:28 UTC 2005


Thanks!

--- Carl Reynolds
<redhat-install-list at hyperbole-software.com> wrote:

> Michael Ault wrote:
> 
> >I need a sed or awk type command that will convert:
> >
> >44.MR3M01J.AF_TBL_COL_1.2005-06-30.DAT
> >
> >to AF_TBL_COL.DAT
> >
> >the 44.MR3M01J. is always the same, the "_1" could
> be
> >both "_1" or "_2", the date varies by month end and
> >the ".DAT" stays the same.
> >
> >  
> >
> Try
>     sed -n -e 's/44.MR3M01J.\(.*\)_[12]\..*/\1.DAT/'
> input-file >
> output-file
> 
> This will also do the same thing:
>     sed -n -e
>
's/[0-9][0-9]\.[0-9A-Z]*\.\([^.]*\)_[12]\..*/\1.DAT/'
> input-file > output-file
> but will allow the prefix and the suffix of the
> input to change. Note
> that it totally disregards the date in the input
> string so it can change
> also.
> 
> 
> 
> Carl.
> 
> 
> 
> _______________________________________________
> Redhat-install-list mailing list
> Redhat-install-list at redhat.com
>
https://www.redhat.com/mailman/listinfo/redhat-install-list
> To Unsubscribe Go To ABOVE URL or send a message to:
> redhat-install-list-request at redhat.com
> Subject: unsubscribe
> 


Michael R. Ault
Senior Consultant
Burleson Oracle Consulting
770-754-9057
www.ault.cc
www.remote-dba.com




More information about the Redhat-install-list mailing list