/ Published in: Java
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 @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 67 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 65 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 27 /*!40101 SET NAMES utf8 */;
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 @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 67 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 65 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 27 /*!40101 SET NAMES utf8 */;
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
awk '{ printf "%5s %8s %s\n", NR, length($0), substr($0,0,180); }' file