From 7ae5096685e48f5141c27b89e38bb55436d66356 Mon Sep 17 00:00:00 2001 From: Javier Quinones Date: Mon, 17 Aug 2026 10:47:33 -0500 Subject: [PATCH] Scripts to merge csv files into a single one --- big_merge.ps1 | 7 +++++++ csv_merge.ps1 | 31 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 big_merge.ps1 create mode 100644 csv_merge.ps1 diff --git a/big_merge.ps1 b/big_merge.ps1 new file mode 100644 index 0000000..131ab5b --- /dev/null +++ b/big_merge.ps1 @@ -0,0 +1,7 @@ +Write-Output "BIG MERGE!!" +Set-Content -Path "FTOptix_Combined.csv" "Location,Site,PLCName,SymbolName" +Get-ChildItem "FTOptix_Import*.csv" -Name | % { + Get-Content $_ | + Select -Skip 1 | + Add-Content -Path "FTOptix_Combined.csv" +} diff --git a/csv_merge.ps1 b/csv_merge.ps1 new file mode 100644 index 0000000..8f31de6 --- /dev/null +++ b/csv_merge.ps1 @@ -0,0 +1,31 @@ +$list = + "SCP_EG2102_15", + "SCP_EG2102_12_A11", + "SCP_EG2102_13_A21", + "SCP_EG2102_10_B11", + "SCP_EG2102_11_B21", + "SCP_EG2102_08_C11", + "SCP_EG2102_09_C21", + "SCP_EG2102_06_D11", + "SCP_EG2102_07_D21", + "SCP_EG2102_04_E11", + "SCP_EG2102_05_E21", + "SCP_EG2102_02_F11", + "SCP_EG2102_03_F21", + "SCP_EG2102_14_R11", + "SCP_EG2102_01_R21" + +function Combine-Csv { + param ( + $sufix + ) + + Write-Output "Writing FTOptix_Combined_$sufix.csv" + Set-Content -Path "FTOptix_Combined_$sufix.csv" "Location,Site,PLCName,SymbolName" + Get-Content "./FTOptix_Combined.csv" | + where { $_ -match $sufix } | + add-content -Path "FTOptix_Combined_$sufix.csv" +} + +Write-Output "Writing to $($list.Count) files" +$list | foreach { Combine-Csv -sufix $_ }