Thursday, May 31, 2012

MS-DOS Helpful Commands

Overview: Record count check


We often need to get record count of a file in Windows. We can always open the file in editplus or notepad++ to get the record count in status bar of GUI, but not all the computer has these editors. Also if the file is of higher size, it is difficult to open in editor. We can get the record count using MS-DOS commands.


Print Line Number in the begining of each line
Command: findstr /R /N "^" file1.txt

Get record count of a file using MS-DOS
Command: findstr /R /N "^" file.txt | find /C ":"

Description - This will tell the record count in a file. It basically searches the string with ":". ":" is added as part of first part where line number is appeneded with ":"

Note: Above commands are searched from some other tutorial websites and I just placed here for ease of access in one place.

Get List of all files from a directory and its subdirectory

dir /s /b /o:gn
 

No comments:

Post a Comment