forked from douglasgscofield/tinyutils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathncol
More file actions
executable file
·30 lines (25 loc) · 666 Bytes
/
ncol
File metadata and controls
executable file
·30 lines (25 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/awk -f
#
# Copyright (c) 2015 Douglas G. Scofield, Uppsala University
# douglas.scofield@ebc.uu.se
# douglasgscofield@gmail.com
#
# This code is covered by the Gnu GPLv2, please see LICENSE.
# Bugs and suggestions to https://github.com/douglasgscofield/tinyutils/issues.
#
# Print the number of columns in each line
#
# CHANGELOG
# 2015-06-21 : create the script
BEGIN {
# parameters
n = 0;
sum = 0;
header = 0; # does the input have a header? if so how many lines?
skip_comment = 1; # skip '#' lines on input
}
{
if (NR <= header) { print; next; }
if (skip_comment && $0 ~ /^#/) { print; next; }
print NF;
}