Code: Select all
C:\test>more file
CODE1QWERTYYUIOPASDFGHJKLZXCCVVBNM 0
CODE2QWERTYYUIOPASDFGHJKLZ1234565MX 012
CODE3QWERTYYUIOPASDFGHJKLZX987654M 0
CODE2^WER:TYYUIOPASDFGHJKLZ123:565MX 0
C:\test>od -c file
0000000 C O D E 1 Q W E R T Y Y U I O P
0000020 A S D F G H J K L Z X C C V V B
0000040 N M
0000060
0000100 0
0000120 \r \n C O D E 2 Q W E R T Y Y U I
0000140 O P A S D F G H J K L Z 1 2 3 4
0000160 5 6 5 M X
0000200
*
0000240 0 1 2 \r \n C O D E 3 Q W E R T
0000260 Y Y U I O P A S D F G H J K L Z
0000300 X 9 8 7 6 5 4 M
0000320
*
0000360 0 \r \n C O D E 2 ^ W E
0000400 R : T Y Y U I O P A S D F G H J
0000420 K L Z 1 2 3 : 5 6 5 M X
0000440
*
0000500 0 \r \r \n
0000513
Code: Select all
C:\test>more test.bat
@echo off
for /f "tokens=1 delims=:" %%i in (
'findstr /bnrc:"................................................................................." "%~1"'
) do echo %%i
C:\test>more test1.bat
@echo off &setlocal
setlocal EnableDelayedExpansion
for /l %%i in (0,1,%~2) do set "dots=!dots!."
echo Lines with more than %~2 characters:
for /f "delims=:" %%i in ('findstr /n "%dots%" "%~1"') do (set "x=1" &echo %%i)
if not defined x echo No line.
pause
C:\test>test.bat file
2
C:\test>test1.bat file 80
Lines with more than 80 characters:
2
but gawk/sed will detect it
Code: Select all
C:\test>gawk "length>80{print NR}" file
2
4
C:\test>sed.exe -n /^.\{81\}/= file
2
4