Hi
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.
Code:
#!/bin/bash
## 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
d="N"
e=" "
a=1
while read LINE ; do
c=$d$a$e$LINE
echo $c >> $3
((a++))
done ;;
remove ) sed -i "s/^ *N[0-9]* //g" $2 ;;
esac
exit 0
enjoy