内容へ移動
Chat GPTでつくったスクリプトや設定の共有とかメモ
ユーザ用ツール
ユーザー登録
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ユーザー登録
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
powershell:文章の分割
文書の過去の版を開いています
。もしこのまま保存すると、この文書が最新となります。
メディアファイル
<code> $inputFile = "C:\path\to\largefile.txt" $outputDir = "C:\path\to\output\" $linesPerFile = 10000 $counter = 0 $fileNumber = 1 $outputFile = Join-Path -Path $outputDir -ChildPath ("split_{0}.txt" -f $fileNumber) # StreamReaderを使ってファイルを開く $reader = [System.IO.File]::OpenText($inputFile) try { while ($reader.Peek() -ge 0) { $line = $reader.ReadLine() Add-Content -Path $outputFile -Value $line $counter++ if ($counter -eq $linesPerFile) { $fileNumber++ $outputFile = Join-Path -Path $outputDir -ChildPath ("split_{0}.txt" -f $fileNumber) $counter = 0 } } } finally { $reader.Close() } </code>
保存
プレビュー
キャンセル
編集の概要
powershell/文章の分割.1693561927.txt.gz
· 最終更新: 2023/09/01 09:52 by
119.231.18.70
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ