PDA

View Full Version : Removing Line breaks



Mask_of_winter
January 18th, 2014, 11:23
After spending hours manually removing line breaks and trying a bunch of find and replace tips for microsoft word that didn't work I have found the perfect tool.

https://www.textfixer.com/tools/remove-line-breaks.php

:D

Blacky
January 18th, 2014, 16:30
Removing line breaks is simple, for example Notepad++ does this in one command.

The trick is usually to handle too little or too many spaces with new/end lines, and to preserve paragraphs (which Textfitter doesn't do, even if it says it does). Most texts and formats are different, so you need to tailor the tool used.

And of course, the ultimate tool is regular expression. Complex of course, but somewhat simple (RTFM obligatory of course) just to remove line breaks. Any decent word processor (like LibreOffice) or text program (like Notepad++) handle regexp in search&replace. Some have more user friendly tools, more limited of course but for example again with Notepad++ its Edit menu has: change upper to lower case and vice versa, merge&joins lines with several options for handling non empty lines (like with spaces), removing spaces before and or after lines, etc. All with keyboard shortcut, to do this fast to the current or selected text.

Nickademus
January 18th, 2014, 18:24
I use that too. I think I saw it in a tut video for FG.

Zeus
January 19th, 2014, 09:45
Here's a handy one liner for Perl which will remove all line breaks from a file:


perl -p -i -e 's/\r\n$/\s/g' file1.txt

Perl can use regular expressions, so it makes short work of such substitutions. In this case 's/\r\n$/\s/g' (which is the regular expression) breaks down as s/<search pattern>/<replacement pattern>/g <apply globally>.

Mask_of_winter
January 19th, 2014, 10:53
Here's a handy one liner for Perl which will remove all line breaks from a file:


perl -p -i -e 's/\r\n$/\s/g' file1.txt

Perl can use regular expressions, so it makes short work of such substitutions. In this case 's/\r\n$/\s/g' (which is the regular expression) breaks down as s/<search pattern>/<replacement pattern>/g <apply globally>.

Ok, sounds good but... how do I do that? copy that line in my document in microsoft word or notepad before I copy the text in it? Sorry, I'm too old for this tech stuff hehe

Thanks for your patience and help!

damned
January 19th, 2014, 11:15
you need to install perl.
https://www.perl.org/

Id try the notepad++ options as something with a more familiar feel...

viresanimi
January 19th, 2014, 16:42
Hey, that is a useful link to know about Mask of Winter. Thanks!

Vires Animi

Trenloe
January 20th, 2014, 15:28
The link provided in the OP is useful.

As mentioned above - Notepad++ does this in one command "Join Lines" which is CTRL+J. There are other very useful text formatting commands available under the "Edit" menu in Notepad++ too.

Nickademus
January 20th, 2014, 18:05
Trenloe has this innate ability to make me feel like a complete idiot at times. It's mostly due to my own laziness, but still. I've been using Notepad++ for a while now and never knew about Ctrl+J or half of the options in the Edit menu...

Thank you very much.

Moon Wizard
January 20th, 2014, 18:23
CTRL+J is also partially supported within FG in the string field and formatted text field types. Currently, it only joins the current line to the following line, not the entire selection.

Cheers,
JPG

Nickademus
January 20th, 2014, 18:30
Also in regards to Notepad++, under the Settings menu is the Shortcut Mapper where you can change the key combination for all the program's options. (I find Ctrl+J a bit awkward.)

mostcallmetim
January 31st, 2019, 22:22
The link provided in the OP is useful.

As mentioned above - Notepad++ does this in one command "Join Lines" which is CTRL+J. There are other very useful text formatting commands available under the "Edit" menu in Notepad++ too.

Trying to speed up my copy and paste (PDF to FG) abilities and while I have Notepad++ I'm not able to figure out how to make the most of it. Before Notepad++ Process was as follows:

1. Copy from PDF
2. Paste into FG story
3. Correct all line breaks via "Backspace"
4. Go through and find any paragraphs breaks to match the PDF.
5. Bold what needs to be bolded.
6. Move on to the next section, repeat.

With Notepad++:

1. Copy from PDF
2. Paste into Notepad++
3. Highlight paragraph sections and Ctrl+J to fix line breaks
4. Copy from Notepad++ and
5. Paste to Fantasy Grounds
6. Bold what needs to be bolded.
7. Move on to the next section, repeat.

Either way its a lot of work and I've looked through the options of Notepad++ and I am not sure what other steps I could take to shorten the process.

Sidenote: I know I could just read from the PDF most of time and it would also save a ton of time, but I figured if I'm going through the trouble to convert the Ashardalon Adventure Path from 3e (The Speaker in Dreams, The Standing Stone, Heart of Nightfang Spire, Deep Horizon, Lord of the Iron Fortress and Bastion of Broken Souls) I might as well make them completely incase others want to use the modules. Which I know are no longer used by WoTC and I couldn't sell on DMSGuild. It's for me and the community however so trying to do them well.

Any suggestions would be majorly appreciated.

Zacchaeus
January 31st, 2019, 22:29
I'm pretty sure that you can't distribute such material, since there's no license agreement with Smiteworks for any WotC stuff apart from 5e.

mostcallmetim
January 31st, 2019, 22:36
I'm pretty sure that you can't distribute such material, since there's no license agreement with Smiteworks for any WotC stuff apart from 5e.

Honestly, I figured that would be the answer, but it won't stop me from using it for my players as I find it to be an exciting adventure. So I guess if its just for me, I might as well make it easy on myself.

LordEntrails
January 31st, 2019, 23:30
I do ctrl+A and then ctrl+j and then put the line/paragraph breaks back in. Not really any better than selecting each section/paragraph and doing ctrl+j, but makes me feel better. Also, be aware that ctrl+j works in FG, not just in NPP.