私たちのT &システムのソフトウェアを更新しました。これはタブ区切り形式のCSVファイルを生成します。給与計算ソフトウェアはセミコロンで区切られた古い形式でこれを必要とします。私は両方のベンダーと連絡を取り合っていて、いずれも他のベンダーに対応する方法がないので、CSVファイルを給与計算ソフトウェアに合わせて変換する必要があります。私は、混在した結果を持つPowerShellでこれをやろうとしました。タブ区切り記号をセミコロンに変換します
まず私は、タブ区切りを削除しますが;
をしなかった
Import-Csv ".\desktop\new version.csv" -Delimiter `t |
Export-Csv ".\converted.csv" -NoTypeInf
を試してみました。だから私は、その後だけヘッダに、;
にタブ付きから、それを変換しました
Import-Csv ".\desktop\new version.csv" -Delimiter `t |
Export-Csv ".\desktop\converted.csv" -NoTypeInformation -Delimiter ";"
を試してみました。残りのデータは完全に無視されました。私は、別のアプローチを試み、正しくファイルをフォーマット
$path = ".\desktop\new.csv"
$outPath = ".\desktop\converted.csv"
Get-Content -path $path |
ForEach-Object {$_ -replace "`t",";" } |
Out-File -filepath $outPath
を使用するが、データの各列の間に余分な空白行を置きます。私は何が間違っているのか分からない!
入力したTSVの形式が間違っていない限り、2番目のコマンドはうまくいきました。 –