Author Topic: Notepad++ Master Thread  (Read 1694 times)

Offline stooges44

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Jan 2017
  • Posts: 6465
  • Total likes: 2762
  • DansDeals.com Hat Tips 269
    • View Profile
Notepad++ Master Thread
« on: February 01, 2017, 10:37:16 AM »
I didn't see one so here's a master thread.

I need to sort text while maintaining the column layout, every white space needs to remain as is which is why i can't use excel because that would kill the layout.

So, does anyone know how to sort by column in notepad++?

Here is sample text:

123702184C01A02  715CP               00018.0000000.00000000000.00
123702184C01A01  715CP               00040.0000000.00000000000.00
123094189C01A02  YM370 Y             00005.2000000.00000000000.00
123094189C01A01  YM370 Y             00040.0000000.00000000000.00
123098610C01A01  W116                00036.4800000.00000000000.00


The 2 spaces between the first 2 columns are critical and so far the only way I see to sort in np++ is on the whole line even with the TextFX plugin but I really need to sort on the 2nd column so I can separate the Y lines.

Any insight is much appreciated. Thanks!
If it's not free shipping it's not worth it.

Offline shwarmabob

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Dec 2014
  • Posts: 1268
  • Total likes: 201
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
Re: Notepad++ Master Thread
« Reply #1 on: February 01, 2017, 11:10:34 AM »
what do you have between the columns? spaces or tabs?

Offline lubaby

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Jun 2010
  • Posts: 5335
  • Total likes: 736
  • DansDeals.com Hat Tips 12
    • View Profile
Re: Notepad++ Master Thread
« Reply #2 on: February 01, 2017, 11:10:55 AM »
Start the project in Excel, use this Formula to find which cells have a Y in it and sort it there (using the 1).

Code: [Select]
=COUNTIF(A1:A1,"*Y*")


You can then move it into Notepad++ if you still need..

Hmm.. I see the Y can also be in the second column. Need to eliminate those.
« Last Edit: February 01, 2017, 11:21:25 AM by lubaby »

Online etech0

  • Dansdeals Lifetime 10K Presidential Platinum Elite
  • *******
  • Join Date: Dec 2013
  • Posts: 12880
  • Total likes: 3369
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
Re: Notepad++ Master Thread
« Reply #3 on: February 01, 2017, 11:16:13 AM »
Start the project in Excel, use this Formula to find which cells have a Y in it and sort it there (using the 1).

Code: [Select]
=COUNTIF(A1:A1,"*Y*")


You can then move it into Notepad++ if you still need..
Or copy it into google sheets and use regex to extract column2, then sort by that column in the google sheet, and copy back to notepad++
Workflowy. You won't know what you're missing until you try it.

Offline stooges44

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Jan 2017
  • Posts: 6465
  • Total likes: 2762
  • DansDeals.com Hat Tips 269
    • View Profile
Re: Notepad++ Master Thread
« Reply #4 on: February 01, 2017, 11:30:08 AM »
How would I maintain the spacing that I need between the columns after taking it out of excel or google sheets?
If it's not free shipping it's not worth it.

Offline stooges44

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Jan 2017
  • Posts: 6465
  • Total likes: 2762
  • DansDeals.com Hat Tips 269
    • View Profile
Re: Notepad++ Master Thread
« Reply #5 on: February 01, 2017, 11:36:42 AM »
Here's my problem after copying it out of excel or saving it as txt from excel, I lose all the spacing that I need:

see attached.
If it's not free shipping it's not worth it.

Offline lubaby

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Jun 2010
  • Posts: 5335
  • Total likes: 736
  • DansDeals.com Hat Tips 12
    • View Profile
Re: Notepad++ Master Thread
« Reply #6 on: February 01, 2017, 11:38:01 AM »
Or copy it into google sheets and use regex to extract column2, then sort by that column in the google sheet, and copy back to notepad++
Cool, that does seem to work better (never seen this formula before).

Code: [Select]
=regexextract(A1, "(Y )" )
How would I maintain the spacing that I need between the columns after taking it out of excel or google sheets?
Copy from Excel and Paste it Notepad++, then copy from Notepad++ and paste into Google Sheets.
Eta, this actually ruins the REGEX formula.

I'm guessing @etech0 has a better understanding of how it works and can help :)
« Last Edit: February 01, 2017, 11:41:34 AM by lubaby »

Online etech0

  • Dansdeals Lifetime 10K Presidential Platinum Elite
  • *******
  • Join Date: Dec 2013
  • Posts: 12880
  • Total likes: 3369
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
Re: Notepad++ Master Thread
« Reply #7 on: February 01, 2017, 11:42:04 AM »
Cool, that does seem to work better (never seen this formula before).
I use regexextract all the time, it's the best way I've found to separate things like first/last names, city/state/zip, etc. It's really cool!
Workflowy. You won't know what you're missing until you try it.

Offline AsherO

  • Global Moderator
  • Dansdeals Lifetime 30K Presidential Platinum Elite
  • **********
  • Join Date: May 2008
  • Posts: 30679
  • Total likes: 7956
  • DansDeals.com Hat Tips 79
    • View Profile
  • Location: NYC
Re: Notepad++ Master Thread
« Reply #8 on: February 01, 2017, 11:45:23 AM »
How would I maintain the spacing that I need between the columns after taking it out of excel or google sheets?

If you paste as text you still lose the spaces? Out of curiosity, why do you need the spaces? Are you pasting it back to the source after filtering out non-"Y" records?
DDF FFB (Forum From Birth)

Offline stooges44

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Jan 2017
  • Posts: 6465
  • Total likes: 2762
  • DansDeals.com Hat Tips 269
    • View Profile
Re: Notepad++ Master Thread
« Reply #9 on: February 01, 2017, 11:52:20 AM »
If you paste as text you still lose the spaces? Out of curiosity, why do you need the spaces? Are you pasting it back to the source after filtering out non-"Y" records?

Yes, see my screenshot above, I lose the spacing after I put it back to np++ or even regular np. And yes, I am importing the flat txt file after it's cleaned up and the import is very space sensitive.
If it's not free shipping it's not worth it.

Offline stooges44

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Jan 2017
  • Posts: 6465
  • Total likes: 2762
  • DansDeals.com Hat Tips 269
    • View Profile
Re: Notepad++ Master Thread
« Reply #10 on: February 01, 2017, 12:10:02 PM »
I might have found a way, until now i  was "opening" up the txt file from excel (file, open, etc..). This time I copied the whole txt, pasted it into excel and filtered out the Y and then I copied back again to np++ and the spacing was there! Woohoo.

Thanks guys.
If it's not free shipping it's not worth it.