// 1、语法 // 这个变量是全局的,每次执行会重置 $i = 0 Get-Content 待拆分的文件名称 -ReadCount 每多少行拆分 -Encoding UTF8 | ForEach-Object { $_ | Out-File -FilePath "拆分后的文件全名称" -Encoding 字符编码 $i++ } // 2、使用示例 $i = 0 Get-Content insert_tmp_user.txt -ReadCount 100000 -Encoding UTF8 | ForEach-Object { $_ | Out-File -FilePath "tmpuser\chunk_$i.sql" -Encoding UTF8 $i++ }
|