You can apply all your sed rules at single run by separating them by ;
like this:
sed -options 's#...#...#g;s#...#...#g;s#...#...#g;'
I hope it makes it easier, Tomas
On Tue, 2016-11-15 at 16:53 -0800, Rich Shepard wrote:
> On Tue, 15 Nov 2016, Robert Citek wrote:
>
> > Not bad thought. But your data does not match your assumptions.
> > You date
> > is not in mm/dd/yyyy format, but rather m/d/yyyy format, where m
> > and d can
> > be either 1 or 2 digits.
>
> Robert,
>
> The data were in all formats, single and double digits for month,
> day, or
> both. Ain't consistency grand? And this from an agency database, too.
>
> > Add a "1," to your count restriction:
> >
> > $ <<< '5/31/2011' sed -re 's#([0-9]{1,2})/([0-9]{1,2})/([0
> > -9]{4})#\3-\1-\2#g'
> > 2011-5-31
>
> That's a great idea.
>
> > BTW, a really good book on regular expressions is "Mastering
> > Regular
> > Expressions, 3rd Edition"
>
> Heh. I have the first edition, 7th printing in December 1998. Only
> slightly older than my sed/awk and shell scripting books. Guess I
> should
> upgrade them. Although, I wonder how much regex has changed in the
> past 18
> years.
>
> Thanks,
>
> Rich
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug