0

Good day,

I am a CNC program not a computer programer. I am using CAM software to make cutting programs for our CNC router. The router is a bit old and can only take files 200-300 kb big. We are doing carvings that require 1-2 megs text files. I am using a program called GSplit ( http://www.gdgsoft.com/gsplit/ ) to divvy up the text file. It generates 10-25+ files with a custom header that our machine can read. All the files are great and it works, but I have to manually add the closing lines/footer to each file. The files that are created and used are normal .txt files but with a specific extension, .ANC.

Is there any way to automate this process of opening each individual file, scrolling to the end and copy/pasting the same 1-2 lines of code? The files are NAME[number].ANC in a contained folder. Would it be possible to just direct to a folder and say "add this 'text' to every file in this folder"?

Thanks for your time.

  • you are an CNC program? That's quite scary, seems like the machines are trying to take over. ;) – dirkk Nov 17 '13 at 17:09

2 Answers2

0

What OS are you using? Using Unix you can do a simple script on command line. If you are in the directory with the specific files simply execute:

for file in *; do echo "APPEND THIS" >> $file; done

If you are running Windows you should be able to do the same using cygwin (probably you could also use the power shell, but I don't know anything about the that)

dirkk
  • 6,160
  • 5
  • 33
  • 51
  • I am using windows 7. Does cygwin run in a window or does this dramatically change my windows look and feel? I am not anti linux, just haven't made the jump yet. Frankly get my cad/cam programs I use to support Linux and I'm there. – user3002048 Nov 18 '13 at 02:45
  • @user3002048 It is just another program, it doesn't affect any look&feel of your system. Take a look at http://cygwin.com/index.html – dirkk Nov 18 '13 at 10:11
0

I found a program Notepad++ (apparently the last person to find it...). USed the find/replace files option. A regular expression(note sure exactly what these are but I'm sure you guys do) "\s+\z" as to what to look for. It finds the last space or whatever at the end of all the files and then adds the code I need. Easy, free, and I don't need to write any computer code. Thanks for the attempt to help me Dirkk! :)