qscan.pl -- Scan for Excessively Long Quoted Strings (new version)
Like 40scan.pl, this program scans a text file or program for double-quoted and single-quoted strings. If found, it reports those which are longer than a defined number of characters. The default is 40 characters, but qscan lets you define other string lengths on the command line.
- This program is intended to be run from a Unix or Linux command line.
- Output is sent to STDOUT, so redirect it to a file to save the output.
- Very long lines will be truncated in the output. This is to keep the output from getting too wide.
- The program looks for double-quoted and single-quoted strings.
- The variable $checklen in the program sets the default length of strings to search for.
- Useful for making sure all your labels are within length limits, including SAS, SPSS limits, or for in-house standards.
- Show qscan.pl code
- Download: qscan.pl
Usage
Assuming this program is executable, its commandline is: qscan [-l#] [filename...]
where:
- -l# is the number of characters within quotes to search for
- filename is the text file to be processed
An example run is shown below.
> qscan test.txt Page 1 qscan: Find long quoted text by Kent Nassen, v1.8, 10/22/99 Scanning for quoted text longer than 40 characters in the file '40scan_versions_test' Quote Line# Length Line Contents/*** Message ------- -------- ---------------------------------------------------------- 51 42 7 42 v3 "This is a longer label for the varia... 52 61 8 61 v4 "This is a very long label for the fo... There were 68 lines in '40scan_versions_test' 3 lines had quoted text over 40 characters long. The length of the longest quoted text found was 61 characters at line 52."
Back to Kent's Perl Page
Last Modified: Tue Sep 2 20:28:31 EDT 2025