「Windows/powershell」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→テキスト文置換) |
(→powershellインストール) |
||
| 行3: | 行3: | ||
macであれば、powershell-x.x.x-osx-x64.pkg をDL | macであれば、powershell-x.x.x-osx-x64.pkg をDL | ||
| + | |||
| + | ==macでスクリプト実行== | ||
| + | $ /usr/local/bin/pwsh /tmp/hoge.ps1 | ||
| + | |||
| + | /tmp/hoge.ps1 | ||
==テキスト文置換== | ==テキスト文置換== | ||
2021年8月10日 (火) 22:33時点における版
powershellインストール
macであれば、powershell-x.x.x-osx-x64.pkg をDL
macでスクリプト実行
$ /usr/local/bin/pwsh /tmp/hoge.ps1
/tmp/hoge.ps1
テキスト文置換
aaaをcccへ置換
$data = Get-Content hoge.txt | % { $_ -replace "aaa", "ccc" }
$data | Out-File hoge.txt
