So you have a text file where you want to add the filename on each start of line for some reason so it can be easily managed as a csv or on Excel.
So do a dir /b > on the directory or create a list of files that require the filename as the begining of each line on those files:
In my example I have a bunch of file names inside asd.txt
for /f "tokens=*" %%i in (asd.txt) do sed "s/^/%%i;/" %%i
or
for /f "tokens=*" %%i in (asd.txt) do sed -i "s/^/%%i;/" %%i
That will add the filename and a semicolon
Such as:
file1;line1
file1;line2
And so on.
Wednesday, May 6, 2015
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment