1#!/bin/sh -u
2
3# remove comments, trailing comments, empty newlines and count loc
4
5line=$(
6 cat $1 \
7 | sed -E '/^[[:space:]]*\/\/.*$/d' \
8 | sed 's|//.*||' \
9 | sed '/^$/d' \
10 | grep -v '//' \
11 | wc -l
12)
13
14echo "$1 is $line LOC"