flyingbird013
flyingbird013

Reputation: 476

How to align text with easy way?

I have a CSV file containing thousands of rows. Each line is delimited by a semi-colon(;), starting with character <-- and ending with character -->. For example like this:

<--;2016;computer printer scaner;
Computer hardwares;-->
<--;2015;computer printer
scaner;Computer hardwares;-->
<--;2014;computer 
printer
scaner;Computer hardwares;-->

I want to edit it so it looks like this:

<--;2016;computer printer scaner;Computer hardwares;-->
<--;2015;computer printer scaner;Computer hardwares;-->
<--;2014;computer printer scaner;Computer hardwares;-->

Usually I do it manually one by one as many as thousands of lines. Thank you very much

Upvotes: 0

Views: 43

Answers (2)

Toto
Toto

Reputation: 91385

It could be done in 1 pass, using lookbehind.

This will replace all linebreaks that is not after the string -->

  • Ctrl+H
  • Find what: (?<!-->)\R
  • Replace with: EMPTY
  • Replace all

Explanation:

(?<!-->)  : negative lookbehind, make sure we don't have "-->"
\R        : any kind of line break

Result for given example:

<--;2016;computer printer scaner;Computer hardwares;-->
<--;2015;computer printerscaner;Computer hardwares;-->
<--;2014;computer printerscaner;Computer hardwares;-->

Upvotes: 0

Tik
Tik

Reputation: 882

in notepad++

  1. go to find and replace. find all instances of \r and \n and replace with nothing (make sure search mode is set to extended)

  2. find --> and replace with -->\n

that should display as your example

Upvotes: 1

Related Questions