From: Dana Merrick Date: 2008-05-14T05:38:08+09:00 Subject: Re: Switch Two Lines in a File --------------enig9E9943A0EF59FEED863FDDDE Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Oh, sorry, I should have mentioned, I'm providing two regexes, and the=20 script is to replace a line that matches one regex with a line that=20 matches the other. I.E. line one line two line three a=3D/one/ b=3D/three/ And the script produces: line three line two line one I intend on passing it robust enough regexes that they only match a=20 single line (i.e. not /line/). -Dana Dana Merrick wrote: > Hey guys, >=20 > I'm trying to write a script to switch two lines in a file, and for som= e=20 > reason am having difficulty grokking it. >=20 > I have an ugly start, which I'll post if you want, but it's over thirty= =20 > lines long and still doesn't work. I'm sure there is a very short, very= =20 > simple, very Ruby solution to this, and I'm sure one of you has it. >=20 > So I'm going to cheat and ask you guys. >=20 > Any ideas? >=20 > -Dana >=20 >=20 --=20 Dana Merrick - System Administrator Integrated Computer Solutions, Inc. 54B Middlesex Tpke, Bedford, MA 01730 617.621.0060 x112 - http://www.ics.com --------------enig9E9943A0EF59FEED863FDDDE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iEYEARECAAYFAkgp/DEACgkQ7b+8UB5G/wPGigCfb1ZnShhI7wN+JTe4vWA8BDoq mrUAnixIgCRtZjN0Ha4It2FnIZD7/B/O =Xnhf -----END PGP SIGNATURE----- --------------enig9E9943A0EF59FEED863FDDDE--