Quantcast Remove extra lines (empty lines) from copied/pasted text with Notepad++ - digitalFAQ.com Support Forum
Go Back   digitalFAQ.com Support Forum > Digital Life > Computers

Reply
LinkBack Thread Tools
  #1  
10-07-2011, 05:28 PM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff / Owner and Editor
 
Join Date: Oct 2009
Posts: 1,305
Thanks: 84
Thanked 138 Times in 132 Posts
I often find myself needing to remove extra junk and extra spaces from copy/pasted text. I'm already using a clipboard stripper (PureText) to remove underlying HTML code or Word code, and then using Notepad (or Notepad++) to search and find/replace duplicate spaces and odd characters. But what about extra line breaks?

Notepad++ has a nifty feature called Extended Search Mode under the Search > Replace options.

To remove empty blank lines, simply find \n\r and then replace with nothing.
All completely empty lines will be removed.

You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community.


The only problem I've run into is when a line is not completely empty. For example, if each line has a space on it. In theory, you could search/replace all single spaces with nothing, but that would obviously mess up text.

If you know how to replace lines with spaces, please reply to this post, and share your knowledge!

The official site for Notepad++ is http://notepad-plus-plus.org
The official site for PureText is http://www.stevemiller.net/puretext/
Both are freeware.


__________________
- Thanks for visiting! | Advertise on The Digital FAQ | Upgrade to Premium Member
- Please Like Us on Facebook | Follow Us on Twitter
Reply With Quote


  #2  
10-07-2011, 05:32 PM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff / Owner and Editor
 
Join Date: Oct 2009
Posts: 1,305
Thanks: 84
Thanked 138 Times in 132 Posts
Also ...

If you want to remove line breaks, and put all text into a single paragraph, you can use the search string \r\n
Notice that the R and N have switched places.

The only caveat here, however, is that spaces may not be added between merged sentences. This is easy enough to fix with two more quick search/replace queries.

1. Find all periods, and replace with period + space --- "." is replaced with ". "

2. For all sentences that previous had a proper space, an extra space has been added. To correct this, simply search/replace two spaces
-- a single space "_" is replaced with two spaces "__"

Easy enough.
__________________
- Thanks for visiting! | Advertise on The Digital FAQ | Upgrade to Premium Member
- Please Like Us on Facebook | Follow Us on Twitter
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with blue vertical lines max_cady Restore, Filter, Improve Quality 3 05-03-2011 04:24 AM
Tracking Lines in the Video - How to fix these VHS tapes? deter Restore, Filter, Improve Quality 27 01-25-2011 12:58 AM
Jvc gr-sxm515 plays with fast forward lines admin Capture, Record, Transfer 0 10-18-2009 03:32 PM
Ulead DVD Workshop PSD lines lordsmurf Author, Make Menus, Slideshows, Burn 3 03-14-2009 08:45 PM
Satellite problem: wavy lines in picture Skuff Home Entertainment and Videography 11 08-09-2006 12:43 PM

Thread Tools



 
All times are GMT -5. The time now is 12:30 PM  —  vBulletin Copyright © 2011 Jelsoft Enterprises Ltd  —  SEO by vBSEO