2

I have a textpad file that has rows of text. For e.g.

Cat: Meaning - animal. The cat ran up the house
Rat: Meaning- rodent. The rat lives in the borough and feeds on leftovers
Word 3: Description
Word 4: Description

I have many such record in my file. I want to insert a line break at the end of every record for proper presentation. Doing it manually is tedious. Please help if you know an automated process to insert line break.

Monnie_tester
  • 439
  • 1
  • 6
  • 20

4 Answers4

5

You can quickly do this by using a feature called "Regular Expressions" to find and add empty lines.

  1. Open up the Find/Replace (Search menu > Replace)
  2. In the "Find what" field, type the following: (^.+$)\n(^.+$)
  3. In the "Replace with" field, type the following: \1\n\n\2
  4. Tick the "Regular expression" checkbox
  5. Click the Replace All button at least twice, but perhaps 3 times, until you get the message Cannot find the Regular Expression
  6. Untick the "Regular expression" checkbox
  7. Close the Replace dialog
  8. Confirm the file is formatted as you are expecting
  9. Save the file.
hargobind
  • 582
  • 2
  • 20
0

You can write a simple C# prgram that uses a loop that adds this code after every line : But first add the namespace using System.Enviorment

Enviorment.NewLine;

If you have any more trouble i'll help with some code to get started

Mordacai1000
  • 329
  • 1
  • 3
  • 14
0
  1. Open up the Find/Replace (Search menu > Replace)

  2. In the "Find what" field, type the following so that the replace occurs at the end of each line: $

  3. In the "Replace with" field, type the following. Note each 'n' represents a <return>. In this instance, I added a return at the end of a SQL statement, the word 'GO' on the next line and another <return>: \n\GO\n

Started with text file containing:

select * from <tablename>
select * from <tablename>

Ended with text file containing:

select * from <tablename
GO

select * from <tablename>
GO

Hope that helps.

Esteban Herrera
  • 2,263
  • 2
  • 23
  • 32
Robin
  • 1
0

from your text it is difficult to understand what you are intending to do. I'll give you some questions. The answers will help others to help you.

  1. Do you really mean textpad as the product from company helios in UK or do you use this word as a general word for a class of tools (like notepad - but there is a general definition AND the tool as part of Windows).
  2. Your file hase line breaks yet. You don't see them, but in the file itself they are present (in Unix systems line feed (hex code 0A) or in the windows world carriage return followed by line feed (hex code 0D 0A)).
  3. Or would you like to publish your text in HTML? So you have to put the necessary tags around each line like paragraph, line break, list item etc.?
Peter
  • 97
  • 13