Executing Regex in Command Line DOS

bewon Posted messages 2 Status Member -  
Mouthon Posted messages 527 Registration date   Status Member Last intervention   -
Hello,

I receive flat files (.txt) that are daily extractions and I need to process them to analyze the results.

I would like to run regex on the flat files from the command line to rewrite them in different ways.
So, I just need to write a batch and run it when I need it.

The thing is, I don't know how to execute regex via a command line editor, it doesn't seem possible anyway...

So, my questions are:

Can we execute regex from the command line, and if so, how?

If not, are there command line editors that can do it?

I don't know how to use programming languages. :$

Thank you in advance.

Bewon

2 answers

Mouthon Posted messages 527 Registration date   Status Member Last intervention   148
 
Hello.

If you have at least Windows 7, you can use Windows PowerShell, which is much more powerful than a simple batch cmd.

It's a programming language, but it's fairly easy to use just like the Windows command prompt.

I found two articles that might help you:

https://www.regular-expressions.info/powershell.html
https://social.msdn.microsoft.com/Forums/office/en-US/ee9b73c0-7fbd-4566-a4c9-ad903c63a19e/creating-batch-file-of-a-powershell-command?forum=sharepointdevelopmentlegacy

I've never really experimented with PowerShell, but I've only heard good things about it. However, I can't provide you with much more information about it.

Another option could be to install a Linux distro in a virtual machine, or to use a live USB, and use grep and other regex (type "man regex" or "man grep" in Google for more info), which are also very powerful and capable of exploring text files in large numbers.
0
bewon Posted messages 2 Status Member
 
Hello Mouthon,

Thank you for your response!

I looked at the sources you sent me, I will dig deeper, but it does seem to be within my reach!

I’ll keep digging and I’ll keep you posted.

Thank you very much!
0
Mouthon Posted messages 527 Registration date   Status Member Last intervention   148
 
You're welcome, it's a pleasure!

Best wishes for the future.
0