eightban's memo

残しておきたい記事をまとめてみました。このブログに書いてあるドキュメントやブログで配布しているファイルの使用によって発生するいかなる損害に対してもこのブログの管理者は責任を負いません。使用する場合は自己責任のもとに使用してください。

bat PowerShell  windows

パワーシェルでテキストファイルを読んで文字列を置換するLinux の SED

更新日:

バッチファイル

powershell -command "(Get-Content .\hello.txt) | %%{ $_ -replace 'hello','konbanwa'} | set-content .\hello.txt

文字列置換のリストを読み複数の条件で置換する

テキストファイルを一度に読むため大きなファイルはできませんが1つのファイルを複数条件で置換できます

powershell -command " $contents = (Get-Content ./t/N.csv); Get-Content put4.txt | ConvertFrom-CSV -header c1, c2 -Delimiter ',' | %%{ $contents = $contents -replace $_.c1,$_.c2} ; $contents "
P,q
b,k
9,m

MultiReplace

gui で行うのはこちらが便利

MultiReplaceの詳細情報 : Vector ソフトを探す!

-bat, PowerShell , windows

Copyright© eightban's memo , 2024 All Rights Reserved Powered by STINGER.