Prompted by a discussion in another thread i thought I would publish my solution to this.
There are quite a few good CAM programs and code generators which insist upon having linenumbers at every line.
LinucCNC will run them, but they are completely superfluous and often very confusing.
The below will strip them or add them, note the different invocations for the 2 commands.
## inserts or removes line numbers at start of each line
## usage: linenumbers insert oldfile newfile
## linenumbers remove filename (overwrites so perform on a copy)
case $1 in
insert ) exec < $2
while read LINE ; do
echo $c >> $3
remove ) sed -i "s/^ *N[0-9]* //g" $2 ;;