Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu User (http://www.linux-archive.org/ubuntu-user/)
-   -   Block oriented search and replace across multiple files. (http://www.linux-archive.org/ubuntu-user/287282-block-oriented-search-replace-across-multiple-files.html)

Ray Parrish 11-28-2009 03:37 AM

Block oriented search and replace across multiple files.
 
Hello,

I am searching for a programmer's editor that does block oriented
search, and replace across multiple files. I have found regexxer, but it
only changes single lines at a time, and will not match a multi-line
search term.

What I want to be able to do is replace several lines of text with
several other lines of text in all open files all at one go.

Does anyone know of an editor that does this?

Thank you, Ray Parrish


--
The Future of Technology.
http://www.rayslinks.com/The%20Future%20of%20Technology.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Kenneth Loafman 11-28-2009 11:33 AM

Block oriented search and replace across multiple files.
 
Ray Parrish wrote:
> Hello,
>
> I am searching for a programmer's editor that does block oriented
> search, and replace across multiple files. I have found regexxer, but it
> only changes single lines at a time, and will not match a multi-line
> search term.
>
> What I want to be able to do is replace several lines of text with
> several other lines of text in all open files all at one go.
>
> Does anyone know of an editor that does this?

Emacs and Eclipse both support multi-line regex expressions. I'm rusty
on Emacs, but with Eclipse just use "(?ms)StartPhrase.*StopPhrase" to
match the paragraph, then replace with whatever you want. Add anchors
as needed.

...Ken

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Ray Parrish 11-28-2009 02:10 PM

Block oriented search and replace across multiple files.
 
Kenneth Loafman wrote:
> Ray Parrish wrote:
>
>> Hello,
>>
>> I am searching for a programmer's editor that does block oriented
>> search, and replace across multiple files. I have found regexxer, but it
>> only changes single lines at a time, and will not match a multi-line
>> search term.
>>
>> What I want to be able to do is replace several lines of text with
>> several other lines of text in all open files all at one go.
>>
>> Does anyone know of an editor that does this?
>>
>
> Emacs and Eclipse both support multi-line regex expressions. I'm rusty
> on Emacs, but with Eclipse just use "(?ms)StartPhrase.*StopPhrase" to
> match the paragraph, then replace with whatever you want. Add anchors
> as needed.
>
> ...Ken
>
Hello,

I have Eclipse on here, but it is a bit over the top for what I want to
do, which is make broadcast changes to my web site's pages. I'm going to
forego the learning curve, and the necessity to remember regular
expressions by writing my own multi document, block oriented search, and
replace program that will allow me to paste in what I want to replace,
and paste in what I want it replaced with, and the program will take
care of searching, and replacing for me.

I should have it done by the end of the day, whereupon I will release it
on my site as open source software for Linux. Maybe by the end of
tomorrow, it depends on whether or not I get stuck anywhere.

Later, Ray Parrish

--
The Future of Technology.
http://www.rayslinks.com/The%20Future%20of%20Technology.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Brian McKee 11-28-2009 03:51 PM

Block oriented search and replace across multiple files.
 
On Sat, Nov 28, 2009 at 10:10 AM, Ray Parrish <crp@cmc.net> wrote:

I am searching for a programmer's editor that does block oriented
search, and replace across multiple files.



What I want to be able to do is replace several lines of text with
several other lines of text in all open files all at one go.



Emacs and Eclipse both support multi-line regex expressions. *I'm rusty
on Emacs, but with Eclipse just use "(?ms)StartPhrase.*StopPhrase" to
match the paragraph, then replace with whatever you want. *Add anchors
as needed.



I have Eclipse on here, but it is a bit over the top for what I want to
do, which is make broadcast changes to my web site's pages. I'm going to
forego the learning curve, and the necessity to remember regular
expressions by writing my own multi document, block oriented search, and
replace program that will allow me to paste in what I want to replace,
and paste in what I want it replaced with, and the program will take
care of searching, and replacing for me.


That's the easy way? :-)

vim will certainly do that, and you almost certainly have it already.
Be happy to help if you give a little more example so I get it right for you...

Brian

--
All you need to know about Ubuntu 9.04 Jaunty -> gconftool -s --type bool /apps/update-notifier/auto_launch false

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Ray Parrish 11-28-2009 05:25 PM

Block oriented search and replace across multiple files.
 
Brian McKee wrote:
> On Sat, Nov 28, 2009 at 10:10 AM, Ray Parrish <crp@cmc.net> wrote:
>>>> I am searching for a programmer's editor that does block oriented
>>>> search, and replace across multiple files.
>
>>>> What I want to be able to do is replace several lines of text with
>>>> several other lines of text in all open files all at one go.
>
>>> Emacs and Eclipse both support multi-line regex expressions. I'm rusty
>>> on Emacs, but with Eclipse just use "(?ms)StartPhrase.*StopPhrase" to
>>> match the paragraph, then replace with whatever you want. Add anchors
>>> as needed.
>
>> I have Eclipse on here, but it is a bit over the top for what I want to
>> do, which is make broadcast changes to my web site's pages. I'm going to
>> forego the learning curve, and the necessity to remember regular
>> expressions by writing my own multi document, block oriented search, and
>> replace program that will allow me to paste in what I want to replace,
>> and paste in what I want it replaced with, and the program will take
>> care of searching, and replacing for me.
>
> That's the easy way? :-)
>
> vim will certainly do that, and you almost certainly have it already.
> Be happy to help if you give a little more example so I get it right
> for you...
>
> Brian
OK, I've install gvim, and have been trying to get it to do a block
replace, but it can't even find the block I copied from the currently
opened file.

What I want to do is take the following block of text -

<link rel="stylesheet" type="text/css" media="all" id="Skin"
title="PeachSkin" href="peach.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="BlueSkin" href="blue.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="BlueonWhiteSkin" href="blueonwhite.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="BlackMarbleSkin" href="blackmarble.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="BlackSkin" href="black.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="WhiteSkin" href="white.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="MarbleSkin" href="marble.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="GreenMarbleSkin" href="greenmarble.css">

And replace it with the following =

<link rel="stylesheet" type="text/css" media="all" id="Skin"
title="GreenMarbleSkin" href="greenmarble.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="BlueSkin" href="blue.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="BlueonWhiteSkin" href="blueonwhite.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="BlackMarbleSkin" href="blackmarble.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="BlackSkin" href="black.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="WhiteSkin" href="white.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="MarbleSkin" href="marble.css">
<link rel="alternate stylesheet" type="text/css" media="all"
title="PeachSkin" href="peach.css">

Notice how the first line of the first block became the last line of the
second block, and the last line of the first block becomes the first
line of the second block. Gvim is not cooperating, and refuses to
replace the text block with the second version above.

Also, I do not see any indication that Vim can do search, and replace
across multiple files simultaneously, so I'm back to writing my program,
which is coming along nicely.

Later, Ray Parrish

--
The Future of Technology.
http://www.rayslinks.com/The%20Future%20of%20Technology.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


All times are GMT. The time now is 11:44 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.