-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathlen
More file actions
executable file
·28 lines (23 loc) · 713 Bytes
/
Copy pathlen
File metadata and controls
executable file
·28 lines (23 loc) · 713 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
#!/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 length of each line in characters, leaving off any newline
#
# CHANGELOG
# 2015-08-25 : create the script. Note skip_comment off by default
BEGIN {
# parameters
header = 0; # does the input have a header? if so how many lines?
skip_comment = 0; # skip '#' lines on input
}
{
if (NR <= header) { print; next; }
if (skip_comment && $0 ~ /^#/) { print; next; }
print length($0);
}