How to get count of Columns and count of lines in file

October 3, 2016 at 02:51:15
Specs: Windows 7
Pipe delimiter file I need to check columns headers and count of lines in file. Source is database and target in file.

See More: How to get count of Columns and count of lines in file

Reply ↓  Report •


#1
October 3, 2016 at 04:00:42
:: get # rows & cols in pipe separated file
::====== script starts here ===============
::
:: pipesep.bat 2016-10-03 17:40:36.57
@echo off & setLocal enableDELAYedeXpansioN

set N=

:main
for /f "tokens=* delims= " %%a in (myfile) do (
set/a N+=1
set S=%%a
set S=!S:^|= !
call :sub1 !S!
echo line !N! has !C! columns
)
goto :eof

:sub1
set C=
for %%i in (%*) do (
:loop
set/a C+=1
if '%2' neq '' (
SHIFT
goto :loop
)
)
goto :eof
::====== script ends here =================

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •
Related Solutions


Ask Question