Search found 5870 matches

by foxidrive
10 Feb 2012 06:25
Forum: DOS Batch Forum
Topic: Findstr output format
Replies: 7
Views: 5924

Re: Findstr output format

@echo off for /f "tokens=1,2 delims=:" %%a in ('findstr /g:c:\hi.txt *.*') do ( for /f "tokens=1 delims=:" %%c in ('findstr /n /c:"%%b" "%%a"') do ( echo --------START------------- echo Search string is:%%b echo File path is :%%~dpa%%a echo Line number is :li...
by foxidrive
10 Feb 2012 05:55
Forum: DOS Batch Forum
Topic: Adding a column to a csv file and populating it
Replies: 21
Views: 15763

Re: Adding a column to a csv file and populating it

When you say 'last empty column' I assume that no other columns with data appear after the last empty one.

Try this:


Code: Select all

@echo off
for /f "delims=" %%a in ('type "file.csv"') do (
>>"fileout.csv" echo.%%a,816
)
by foxidrive
10 Feb 2012 04:26
Forum: DOS Batch Forum
Topic: Adding a column to a csv file and populating it
Replies: 21
Views: 15763

Re: Adding a column to a csv file and populating it

Do you mean you want to add a new column header and 816 to the end of each row? If so then try this: BATCH.BAT file.csv AL 816 @echo off :: %1 is the input filename :: %2 is the new column header :: %3 is the dummy number to fill every cell in the new column setlocal set "file=%~1" set &qu...
by foxidrive
10 Feb 2012 04:12
Forum: DOS Batch Forum
Topic: how to use :Format function effectively
Replies: 12
Views: 4041

Re: how to use :Format function effectively

Modified code, new reply: This is a similar routine but it allows more strings and uses a single formatting number which is applied to all the strings. It doesn't do what the OP wants because it doesn't have the smarts to split lines into, say, three terms per line and the width of the dos window wi...
by foxidrive
10 Feb 2012 03:43
Forum: DOS Batch Forum
Topic: how to use :Format function effectively
Replies: 12
Views: 4041

Re: how to use :Format function effectively

With some testing it appears that the [-widthoffset] has to be specified for each term. See below. It only seems to support 8 terms. @echo off call :format [-3][-3][-3][-3][-3][-3][-3][-3] 1 2 3 4 5 6 7 8 pause goto :eof :Format fmt str1 str2 ... -- outputs columns of strings right or left aligned :...