-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add windows support to the grep linter #75
Comments
ChatGPT: In PowerShell, you can use the Here's how you can use the # Basic usage of -replace without extended regular expressions
$text = "Hello, World!"
$newText = $text -replace "Hello", "Hi" If you specifically need extended regular expressions, you can use the # Using [regex]::Replace() with extended regular expressions
$text = "Hello, World!"
$newText = [regex]::Replace($text, "H.llo", "Hi") In this example, we're using the Keep in mind that while PowerShell's |
In PowerShell, you can use the
Here's how you can use Select-String -Pattern 'your_pattern' -Path 'your_files' -AllMatches -IgnoreCase | Select-Object -Property LineNumber,Line Replace Here's a breakdown of what each part does:
This PowerShell command should give you similar functionality to |
could we use Python to implement the grep like https://stackoverflow.com/questions/1921894/grep-and-python? |
Basically, the grep -nEHI '[[:blank:]]$' behaves differently in Windows, Linux and Windows WSL. From the time being, the search only works in Linux. In Windows, I have to use [[:space:]] for the match. in WSL, [[:blank:]] doesn't match anything and [[:space:]] would print lots of empty lines. Windows grep using https://gnuwin32.sourceforge.net/packages/grep.htm: |
I think so! There's going to be some performance penalties, but better for it to work than failing I guess |
Potentially using Select-String and
replace
Select-String -Pattern 'n' -AllMatches
The text was updated successfully, but these errors were encountered: