Find Lines Longer than Specified Length

When editing data files, sometimes you need to find the lines that are longer or shorter than a certain length to make corrections. However when a data files has several hundred thousand or millions of rows, this can be a very time consuming task. The way to accomplish this is to use "awk".

awk is a program that is often used for parsing and processing data into readable chunks. An example would be reading a CSV file into a script to display a particular output.

What is the command:

awk 'length($0)>50' datafile.txt

Breaking down the command we have:


This is the program that we are running


This is the argument that is passed to the program.