How do create a Batch file to add “END” to last row of .csv file

I have a process that runs daily to pull retail transactions from our POS system that it outputs as a .csv file. we then send the file over to our accounting department where they manipulate the data to be imported into another system. They have asked if I can add the word “END” after the last transaction line so they can use scripting to determine if all the contents of the file were imported correctly

I would like to be able use a batch file to append the existing file without creating a copy of it as our file names are specific to each date they are created

here is the sample data. with it being a .csv file, I would assume an additional row would need to be added to the end?

DATASET|HOST|HOSTSERVER|LOCATION|PERIOD|REGISTERNUMBER|CASHIERUSERNAME|SESSIONID|SESSIONSTARTDATETIME|SESSIONENDDATETIME|TRANSACTIONID|TRANSACTIONNUMBER|TRANSACTIONDATETIME|TRANSACTIONDATE|DATEKEY|TRANSACTIONTIMEINSECONDS|TRANSACTIONTYPE|FIRSTPAYMENTTYPE|FIRSTPAYMENTAMOUNT|FIRSTPAYMENTCARDTYPE|FIRSTPAYMENTACCOUNT|FIRSTPAYMENTACCOUNTNUMBER|FIRSTPAYMENTEMPLOYEEID|FIRSTPAYMENTCHARGEACCOUNTGROUP|SECONDPAYMENTTYPE|SECONDPAYMENTAMOUNT|SECONDPAYMENTCARDTYPE|SECONDPAYMENTACCOUNT|SECONDPAYMENTACCOUNTNUMBER|SECONDPAYMENTEMPLOYEEID|SECONDPAYMENTCHARGEACCOUNTGROUP|DISCOUNTPERCENTAGE|DISCOUNTDESCRIPTION|DISCOUNTAMOUNT|SURCHARGEPERCENTAGE|SURCHARGEDESCRIPTION|SURCHARGEAMOUNT|COUPONUSEDAMOUNT|COUPONAMOUNT|COUPONDISCAMOUNT|COUPONDESCRIPTION|VOIDAMOUNT|REWARDDESCRIPTION|REWARDAMOUNT|TAXAMOUNT|TAXDIFF|GROSSSALESCOUNT|GROSSSALESAMOUNT
IHC_TST|HSADMIN|LPV-COMPTDEV01.CO.IHC.COM|Master|Breakfast|2|ldbevans|48|2022-01-21 08:21:00|2022-01-21 11:46:27|92|000100002220121082100|2022-01-21 08:21:00|2022-01-21|20220121|32|Void||0|||||||0||||||||0|||0|0|0|0||11.13||0|0|0|0|0
IHC_TST|HSADMIN|LPV-COMPTDEV01.CO.IHC.COM|Master|Breakfast|2|ldbevans|48|2022-01-21 08:21:00|2022-01-21 11:46:27|93|000100002220121085529|2022-01-21 08:55:29|2022-01-21|20220121|17|Void||0|||||||0||||||||0|||0|0|0|0||16.07||0|0|0|0|0
IHC_TST|HSADMIN|LPV-COMPTDEV01.CO.IHC.COM|Master|Breakfast|2|ldbevans|48|2022-01-21 08:21:00|2022-01-21 11:46:27|94|000100002220121091317|2022-01-21 09:13:17|2022-01-21|20220121|48|Void||0|||||||0||||||||0|||0|0|0|0||0.99||0|0|0|0|0
IHC_TST|HSADMIN|LPV-COMPTDEV01.CO.IHC.COM|Master|Lunch|2|ldbevans|49|2022-01-21 11:47:26|2022-01-21 11:47:26|95|000100002220121114726|2022-01-21 11:47:26|2022-01-21|20220121|36|Sale Cash|Cash|0|||||||0||||||||0|||0|5.98|7|0|PrePaid Voucher $7|0||0|0|0|1|5.98

I am running this process on an Windows 2016 server

Thank you

Answer

Attribution
Source : Link , Question Author : Brandon , Answer Author : Community

Leave a Comment