Skip to content

Instantly share code, notes, and snippets.

@fahadysf
Created January 31, 2023 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fahadysf/6ed87fc67105ad6301782608a539081f to your computer and use it in GitHub Desktop.
Save fahadysf/6ed87fc67105ad6301782608a539081f to your computer and use it in GitHub Desktop.
There ya go!
$input_file = ".\sample.txt"
$output_file = ".\out.txt"
$text = Get-Content $input_file -Raw
$text | select-string '"[^\"]+"' -AllMatches | Foreach-Object {$_.Matches} | Foreach-Object { $text = $text.replace($_.Groups[0].Value, $_.Groups[0].Value.replace(' ', '_'))}
echo $text
echo $text > $output_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment