Discussion:
Deleting blank lines within a selection (using a macro)
Randy Kramer
2009-01-29 20:15:41 UTC
Permalink
I'm drawing a blank atm, and, so far, google hasn't helped me.

Anybody know how to delete blank lines within a selection (in a macro)?
My macro has just sorted a range of lines and there may be blank lines
that I want to get rid of.

Thanks!

Randy Kramer
--
I didn't have time to write a short letter, so I created a video
instead.--with apologies to Cicero, et.al.
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Mike Macaskill
2009-01-29 22:47:58 UTC
Permalink
Try
replace_in_selection("^[ |\\t]*\\n", "", "regexNoCase")

Mike Macaskill
NCC Computing Support
Australian Government
Bureau of Meteorology
Tel 9669 4265 Fax 9669 4760
-----Original Message-----
Sent: Friday, 30 January 2009 7:16 AM
Subject: Deleting blank lines within a selection (using a macro)
I'm drawing a blank atm, and, so far, google hasn't helped me.
Anybody know how to delete blank lines within a selection (in
a macro)?
My macro has just sorted a range of lines and there may be
blank lines
that I want to get rid of.
Thanks!
Randy Kramer
--
I didn't have time to write a short letter, so I created a video
instead.--with apologies to Cicero, et.al.
--
http://www.nedit.org/mailman/listinfo/discuss
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Randy Kramer
2009-01-29 23:13:40 UTC
Permalink
Post by Mike Macaskill
replace_in_selection("^[ |\\t]*\\n", "", "regexNoCase")
Mike,

Perfect--thank you!

Randy Kramer
--
I didn't have time to write a short letter, so I created a video
instead.--with apologies to Cicero, et.al.
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Mike Macaskill
2009-01-29 23:27:27 UTC
Permalink
FYI, I created the macro using:

Learn Keystrokes (Alt+K)
Select text
Replace using the regex '^[ |\t]*\n'
Finish Learn (Alt+K)
Preferences->Default Settings->Customise Menus->Macro menu (I don't know
the hot key for this)
Paste learn/Replay Macro
Then you can can give the macro a menu entry in the text box and
save it by hitting the OK button
Voila!!
Hope this helps!!


Mike Macaskill
NCC Computing Support
Tel 9669 4265 Fax 9669 4760
-----Original Message-----
Sent: Friday, 30 January 2009 10:14 AM
To: General NEdit discussion list
Subject: Re: Deleting blank lines within a selection (using a
macro)[SEC=UNCLASSIFIED]
Post by Mike Macaskill
replace_in_selection("^[ |\\t]*\\n", "", "regexNoCase")
Mike,
Perfect--thank you!
Randy Kramer
--
I didn't have time to write a short letter, so I created a video
instead.--with apologies to Cicero, et.al.
--
http://www.nedit.org/mailman/listinfo/discuss
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Randy Kramer
2009-01-29 23:59:27 UTC
Permalink
Post by Mike Macaskill
Learn Keystrokes (Alt+K)
---<other good stuff snipped>---

Thanks--I'm used to recording keystrokes--I had trouble getting replace
and the regex to work--just some sort of mental block.

I'm sure the reminder will help others as well!

Thanks again!

Randy Kramer
--
I didn't have time to write a short letter, so I created a video
instead.--with apologies to Cicero, et.al.
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Andrew Hood
2009-01-31 05:05:16 UTC
Permalink
Post by Mike Macaskill
Try
replace_in_selection("^[ |\\t]*\\n", "", "regexNoCase")
replace_in_selection("^\\s*\\n", "", "regex")

works no matter what the whitespace chars are.
--
There's no point in being grown up if you can't be childish sometimes.
-- Dr. Who
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Loading...