- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2019-10-15T06:24:09+00:00","default:admin","admin")
#author("2019-11-19T11:03:15+00:00","default:admin","admin")
こんなの作らないで、unixのコマンドを普通に使えるようにしてくれりゃいいのに...
-[[powershell チートシート:https://qiita.com/jca02266/items/a0c71ae90d055ab3893c]]
-[[Windows PowerShell でのスクリプティング:http://www.microsoft.com/japan/technet/scriptcenter/hubs/msh.mspx]]
-[[Windowsスクリプティング環境比較:PowerShell vs WSH:http://www.atmarkit.co.jp/fwin2k/operation/pshvswsh/pshvswsh_01.html]]
-[[Windows PowerShell徹底解説:http://itpro.nikkeibp.co.jp/article/COLUMN/20061106/252598/]]
-[[それ PowerShell でできるよ:https://qiita.com/cd01/items/da9a36582372e7d0a7f6]]
-[[PowerShell 使い方メモ:http://qiita.com/opengl-8080/items/bb0f5e4f1c7ce045cc57]]
-[[なぜPowerShellが危険なのか? 増え続ける悪用の現状:http://www.itmedia.co.jp/enterprise/articles/1702/08/news018.html]]
-[[MicrosoftがPowerShellをオープンソース化しLinuxやOS Xにも提供…Bash on Windowsとの差別化は?:http://jp.techcrunch.com/2016/08/19/20160818microsoft-open-sources-powershell-brings-it-to-linux-and-os-x/]]
-[[ナンバーズ予想で学ぶ PowerShell によるデータ分析:https://qiita.com/mwmsnn/items/0e3e5cc1980272858ad8]]
-[[PowerShellでファイルにリダイレクトしたときに勝手に改行される場合の対処:https://qiita.com/gimKondo/items/20e1a5a1b2898c5c5fbd]]
*コマンド [#b2dddd24]
**Select-Object [#t343706d]
-[[Select-Object コマンドレットを復習:https://qiita.com/miyamiya/items/059430d5499f0fe336ff]]
*Tips [#h5b822ef]
-[[Powershell で省略しないで表示する:http://tooljp.com/qa/Powershell-not-Omit-735E.html]]
--以下のオプションを使用します。フォーマットとして自動サイズ調整、および自動改行のオプションを使用します。
Format-Table -AutoSize -Wrap
**tail [#f090da93]
> Get-Content C:\var\log\nlog-own-2017-11-27.log -wait -tail 10 -Encoding UTF8
**touch [#g0a801f1]
-作成日時
> Set-ItemProperty .\test.txt -Name CreationTime -Value "2018/06/12 15:30:00"
-更新日時
> Set-ItemProperty .\test.txt -Name LastWriteTime -Value "2018/06/12 15:30:00"
**grep [#m20ce9b6]
-[[grepコマンドとPowerShellのsls (Select-String)の比較:http://tech.sanwasystem.com/entry/2016/07/05/185717]]
-[[Windowsでgrep:http://d.hatena.ne.jp/ys4145/20110408/p1]]
-[[powershellでCSV等の区切り文字があるファイルの数値列の合計を計算する:https://qiita.com/gyoon/items/a74fe70959e51d584951]]
-実行例
type target.txt | sls "foo" | sls "bar" | % { $_.ToString() } > hoge.txt
-「ファイル名:行番号」を出力しない
select-string [検索文字列] | select Line | Out-String -Width 4096
select-string [検索文字列] | select Line | Format-Table -Property * -AutoSize | Out-String -Width 4096
-空行削除
(gc [ファイル名] | ? {$_.trim() -ne "" }
**wc -l [#se7047d4]
(Get-Content [ファイル] | Measure-Object).Count
**cut [#a7427c45]
-[[Windows PowerShell : UNIXの cut コマンド相当の作業をする。:https://www.engineer-memo.net/20110122-2750]]
Get-Content “.\list.txt” | Select-Object {$($_-split(“,”))[0]}
**uniq [#z76e4217]
-[[オブジェクトをユニークにして存在数を付加する PowerShell フィルター:https://www.vwnet.jp/Windows/PowerShell/2016092401/CountUnique.htm]]
-[[PowerShell で、多項目中、複数項目の数の集計:https://qiita.com/bunzaemon/items/43e515bf07379a5ba2af]]
-項目毎の件数を求める(uniq -c)
cat hoge.txt | group $_ | select name,count
*メール送信 [#m4bbfd5c]
-[[PowerShellでメール送信:https://qiita.com/arachan@github/items/e93c2fec8fe5f7f66bfa]]