Return to Snippet

Revision: 65036
at October 17, 2013 20:42 by mahome


Initial Code
awk '{ printf "%5s %8s     %s\n", NR, length($0), substr($0,0,180); }' file

Initial URL


Initial Description
This is useful to view files with long lines like MySQL dumps.

Example output: line, lenght, first characters (as defined in `substr`)

        1       19     -- MySQL dump 10.11
        2        2     --
        3       36     -- Host: localhost    Database: live
        4       57     -- ------------------------------------------------------
        5       40     -- Server version	5.0.51a-3ubuntu5.4-log
        6        0     
        7       65     /*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
        8       67     /*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
        9       65     /*!40101 SET @[email protected]@COLLATION_CONNECTION */;
       10       27     /*!40101 SET NAMES utf8 */;

Initial Title
Print file with line number, line lenght and starting line

Initial Tags


Initial Language
Java