1

Let's say I have this in Notepad++:

CHARGE_ID   LAST_MODIFIED   CHARGE  PROPORTION  CURRENCY_ID ACCOUNT_ID
2194703831  28-06-2016 11:44:02 2.49    1   95000060    590511

I would like to convert it like that:

CHARGE_ID: 2194703831
LAST_MODIFIED: 28-06-2016 11:44:02
CHARGE: 2.49
PROPORTION: 1
CURRENCY_ID: 95000060
ACCOUNT_ID: 590511
3
  • 3
    do you have only two rows to transform or there are multiple? Are items separated by tab characters or by spaces (is it fixed with)? Jun 28, 2016 at 10:41
  • It could be more. But for now two rows is OK. Yes, they are separated by tab character Jun 29, 2016 at 16:13
  • I don't know the info for your situation, but I'm sure someone good with regular expressions could go into Search -> Find -> Replace -> Check regular expression in down direction and fill out the Find what: and replace with: fields with a possible solution
    – ProdIssue
    Mar 28, 2017 at 14:57

2 Answers 2

4

You need to choose right tool for the job. Use Excel to help you with your text file. Inside the Excel:

  1. Use Text import wizard (menu Data > From Text) to import values into cells.

  2. Select imported cells (as rectangular selection) and use Copy.

  3. Use Paste Special with Transpose option to flip rows and columns (this is what you requested).

  4. Paste the result back to text file.

1

Use Regular Expression (REGEX)

  1. Open Find (CTRL+F)
  2. Make sure within the "Search Mode", the "Regular expression" is checked [o]
  3. Paste the below line in "FIND" box
^([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\r\n^([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\r\n\r\n
  1. Paste the below line in "REPLACE" box
$1: $7\r\n$2: $8\r\n$3: $9\r\n$4: $10\r\n$5: $11\r\n$6: $12\r\n \r\n

 

^        = From the start of line
([^\t]+) = All those which are not a TAB char.
\t       = Followed by a TAB char.
\r\n     = New Line / Linefeed / End of line char  
$1,$2....= Refers to the position of ([^\t]+) in the FIND

NOTE: I added extra \r\n\r\n at the end of REPLACE as I thought you might want to separate multiple sets of records.

2
  • 1
    I don't think you want to include email here, especially in non-obfuscated form, unless you like spam.
    – Destroy666
    Apr 15, 2023 at 2:53
  • Removed email address.
    – psp comm
    Apr 15, 2023 at 3:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .