[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs regex to transform text of field1\nfield2\n into field1\tfield
From: |
Eric Abrahamsen |
Subject: |
Re: emacs regex to transform text of field1\nfield2\n into field1\tfield2\n etc |
Date: |
Sat, 16 Feb 2019 08:16:46 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Angus Comber <anguscomber@gmail.com> writes:
> I worked it out.
>
> m-%
>
> ^\(.*\) Ctrl-Q newline \(.*\)
>
> with
>
> \1 <tab> \2
>
> On Sat, 16 Feb 2019 at 11:23, Angus Comber <anguscomber@gmail.com> wrote:
>
>> I have a text file of modem country codes like this:
>>
>> T.35 Code
>> Country
>> 00
>> Japan
>> 07
>> Argentina
>> 09
>> Australia
>> 0A
>> Austria
>>
>>
>> But I want to transform the buffer to look like this:
>> T.35 Code Country
>> 00 Japan
>> 07 Argentina
>> 09 Australia
>> 0A Austria
>>
>> What regex would do that?
FWIW, I usually do these things with keyboard macros. If the source data
is very regular, it can be much faster than finding the right regex. In
this case it would be very easy to record: end-of-line,
delete-next-character, insert-tab, next-line.
Eric