Search code examples
regexreplacenotepad++git-bashwc

How to replace one character after a set of different numbers


I have been trying to solve this for a while now.

Example of the issue:

 4946990 stuffandthings.sql.gz
 5005868 Hello there.txt
 1033557 This is an issue.txt
  303500 That_I need help fixing.txt
 8737976 Please help.txt
99737976 Thanks.txt

What I'm trying to do:

 4946990     stuffandthings.sql.gz
 5005868     Hello there.txt
 1033557     This is an issue.txt
  303500     That_I need help fixing.txt
 8737976     Please help.txt
99737976     Thanks.txt

and/or this:

 4946990 | stuffandthings.sql.gz
 5005868 | Hello there.txt
 1033557 | This is an issue.txt
  303500 | That_I need help fixing.txt
 8737976 | Please help.txt
99737976 | Thanks.txt

Basically I'm trying to replace the first character after a set of different numbers.

I fetched this "array" or "list" from the GitBash command, "wc -l" (which prints the amount of line numbers inside a text file, along with the text file name next to it). So if there's anyway I could use regex to complete what I want it to do, or if there's a command I'm not seeing in GitBash that could help do this. Any help would be appreciated, Thanks.


Solution

  • Find:

    ([0-9])[ ]([a-zA-Z])
    

    Replace:

    \1 | \2
    

    or:

    \1     \2