Gcode on offline controller - editing in Notepad ++

Follow up to this post

The post above got me started on a more complete hunt. What I found was this page:
the second answer down is better than the selected answer

As others have noted, in Notepad++ 6.0 and later, it is possible to use the “Replace” feature to delete all lines that begin with “;” or “#”.

Tao provides a regular expression that serves as a starting point, but it does not account for white-space that may exist before the “;” or “#” character on a given line. For example, lines that begin with “;” or “#” but are “tabbed-in” will not be deleted when using Tao’s regular expression, ^(#|;).*\r\n.

Tao’s regular expression does not account for the caveat mentioned in BoltClock’s answer, either: variances in newline characters across systems.

An improvement is to use ^(\s)*(#|;).*(\r\n|\r|\n)?, which accounts for leading white-space and the newline character variances. Also, the trailing ? handles cases in which the last line of the file begins with # or ;, but does not end with a newline.

For the curious, it is possible to discern which type of newline character is used in a given document (and more than one type may be used): View → Show Symbol → Show End of Line.

That coupled with Oz’s response from the above thread about converting LF to CR LF (Unix to Windows style) makes it work really well on the offline controller.
would just link. as a new user, I’m limited to 2 links per post.

If you’re using Notepad++, you should just be able to right-click on the ‘Line Endings’ type in the status bar, pick the Windows one, and re-save. No search/replace required.


I’ve created a NP++ macro to convert my LB generated gcode in one click. Works well!

  • Dean

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.