Command Like head for Line Truncation

software-rectext processing

Linux's head selects a number of lines from the top of a file. Is there a command that selects a number of characters from the front of a line?

The use case behind the question is this: I want to head the first 10 lines from a file, but each of those 10 lines is extremely long and contain lots of white space, making it hard to discern where the line breaks are.

It would be much easier to get a general idea of the contents of the file if I could head the first 10 lines, but only view the first 50 characters of each line.

Best Answer

Try cut:

head -n 10 bigfile | cut -c 1-50
Related Question