1

I'm trying to convert a file into txt and sort it. I'm using wget, that I've already installed

wget 'https://bitkeys.work/btc_balance_sorted.csv'
cut -d, -f 1 btc_balance_sorted.csv | grep -v address > public_addresses_sorted.txt

When I enter the above command, it says that grep isn't recognized as a command.

I'm using the Windows command prompt.

anishsane
  • 20,270
  • 5
  • 40
  • 73
Vaxind
  • 96
  • 1
  • 1
  • 7
  • 1
    Grep is not part of the Windows operating system. See this post for alternatives: [Grep alternatives](https://stackoverflow.com/questions/87350/what-are-good-grep-tools-for-windows) – Qwerty Apr 29 '22 at 13:17
  • You can use `findstr` in place of `grep` in this context. But for `cut`, it's tricky. I think there is a `for` loop mechanism to do the `cut` operation. But if you want better functionality, you can install cygwin or just [`gnu coreutils`](http://gnuwin32.sourceforge.net/packages/coreutils.htm) – anishsane Apr 29 '22 at 13:23
  • The Windows Command Processor `cmd.exe` does not interpret the character `'` like the Linux/Mac shell interpreters. The character `'` has no special meaning for `cmd.exe`, except within the round brackets of a `for /F` loop. You have to use in a Windows batch file `"` to get interpreted all characters of an argument string as literal characters with exception of `%` and of `!` if delayed expansion is enabled too. – Mofi May 14 '22 at 16:43
  • You have installed already `wget.exe` on Windows and this executable is even found by `cmd.exe`. So you can use in the batch file `wget.exe "https://bitkeys.work/btc_balance_sorted.csv"` as first line and `(for /F "usebackq skip=1 delims=," %%I in ("btc_balance_sorted.csv") do echo(%%I)>"public_addresses_sorted.txt"` as second line which should produce the text file with the wanted data. – Mofi May 14 '22 at 16:44

1 Answers1

0

You can use the cygwin- it's open-source and will let you use grep.

The cygwin package contains a dll - cygwin.dll and a bunch of Linux utilities compiled for windows, (e.g. cut.exe, grep.exe, etc) that can be used on the cmd prompt or in a batch file.

Of course, you will need to add C:\cygwin\bin to the PATH variable.

anishsane
  • 20,270
  • 5
  • 40
  • 73
Anshu
  • 80
  • 6
  • 1
    The downside of using `cygwin` is that it overrides windows' inbuilt utilities - for instance in windows, `find` locates strings within a file, but under `cygwin`, `find` is some variety of file-locator. – Magoo Apr 29 '22 at 14:16