0

I'm using notepad++. I have a very large file (1gb) that uses a pipe as the delimiter. Unfortunately, there is a column in the file has data that also uses a pipe. Is there a way to specify a column range (like 300-350) across a million rows that finds the pipe and replace it with a dash.

2 Answers2

0

For very large files, use command line tools to parse the file. For 1GB a visual editor for editing is counter productive.

The most popular tools for accomplishing your task is awk.

You can use awk in Bash shell after installing GIT.

My favorite Windows Bash shell alternative is Mobaxterm free.

Or using the built in Bash shell in Windows 10.

If you post few sample rows from the large file, and post another question, contributors will assist you with awk as well.

Once you have text processing tools, the tool to extract the top 10 lines is head.

head largeFile.txt

There is also a PowerShell solution to extract the top few lines from a large file, in this answer.

Dudi Boy
  • 4,551
  • 1
  • 15
  • 30
  • I have to use notepad++ because im able to run it without actually installing anything. This works for one column Find: ^.{300}\K| Replace:- However, i need to figure out how to increment to the next column 50 times. – Bob Johnson Oct 25 '19 at 22:24
0
  • Ctrl+H
  • Find what: ^.{300}[^|]{0,50}+\K\| ( Adjust the values at your convenience )
  • Replace with: -
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline*
  • Replace all

Explanation:

^               # beginning of line
  .{300}        # 300 any character but newline
  [^|]{0,50}    # 0 up to 50 any character that is not a pipe
  \K            # forget all we have seen until this position
  \|            # a pipe

I've done a test with a smaller file, it replaces pipe with hyphen between the 13th and the 22nd column to show the method, adjust the values as you like:

Screen capture (before):

enter image description here

Screen capture (after):

enter image description here

Toto
  • 89,455
  • 62
  • 89
  • 125