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

Reply
 
LinkBack Thread Tools
  #1  
10-07-2011, 05:28 PM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,319
Thanked 370 Times in 339 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.

notepad-plus-search-replace-linebreaks.jpg

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.



- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
10-07-2011, 05:32 PM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,319
Thanked 370 Times in 339 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.

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Tracking lines in video; how to fix these VHS tapes? deter Restore, Filter, Improve Quality 29 08-17-2020 01:28 PM
Need help with blue vertical lines max_cady Restore, Filter, Improve Quality 3 05-03-2011 04:24 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 Videography: Cameras, TVs and Players 11 08-09-2006 12:43 PM

Thread Tools



 
All times are GMT -5. The time now is 03:26 PM