Line Removal from .CSV via Batch Script

DigNChiefs

I have 80+ uniquely named .csv files I need to remove the first 17 lines from. I am new to writing batch scripts, but would like to use this opportunity to learn.

I have been able to make this sample code work for a single file when I rename a file to test.csv, but it would be preferred if there was a "Wild Card" for file name I could use.

@echo off
set "csv=test.csv"
more +17 "%csv%" >"%csv%.new"
move /y "%csv%.new" "%csv%" >nul

File itself is updated to NOT have the first 17 lines and renames named as it is started.

SachaDee

try like this :

@echo off

for %%a in (*.csv) do (
    more +17 "%%a" >"%%a.new"
    move /y "%%a.new" "%%a" >nul
)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

how to run a batch line from lua script

Replace line in textfile from a Batch script

Executing parameterized .exe files via batch script (Windows command line)

Export CSV From Postgres VIA Command Line

batch tsv to csv script

Removing some columns and rows from csv file via batch

Send commands from Windows to Linux via Batch Script SSH

Echo text with Unix line endings from a Windows batch (.bat) script

Skip line with a specific string from a file - Batch script

". was unexpected at this time" generated from batch script line 'if exist [file] (...

Export csv file from scrapy (not via command line)

Curl request from command line and via Groovy script

Invoke command line as in a batch script

Insert line in a file with batch script

Batch removal of special characters from file names in windows

Batch removal of special characters from file names in Linux

How to download CSV file from PHP script via AJAX?

How to Hide/Remove the header from output csv via Powershell script

How to insert new line char to powershell script variable called from batch script with single quoted variable

UWP C++ self removal from canvas via EventHandler

Command line parameters missing special characters like ! when ran via batch file from Inno Setup

remove only specific data from registry value REG_MULTI_SZ via batch file/command line

Removal of special characters from string using perl script

Unpin File Explorer from the taskbar in Windows 10 via script or batch file

Parsing csv via column order in spring batch

Empty CSV file after recode via BATCH

Delete last line always starting with 'TRAILER' from a text file in windows batch script

Compiling c++ from command line using nmake or another tool like batch script

Why is an unwanted empty line output on running a PowerShell script from within a Windows batch file?