I have been searching for a few weeks now for solutions but can't find a clear way to do this.
There are a number of challenges because the column vales change in size for example row in a job/printout may have a a LENGTH value of 345 while a new row will have a LENGTH value of 2345 (please see example below)
To add to this the first few lines in the table in the printout have multiple fields in like this :
CUSTOMER: MRS. ELLIE BLOM
ORDER NO: JOB NO:
Ideally I would like to automate the procedure either using code or a script, the environment is windows.
The output is from a very old DOS program which controlled a cutting machine and works super fast but doesn't generate a properly formatted csv file which I'd like to use for my diy projects.
I would like help and/or advice to remove the junk ( all the extra print pcl codes and other characters), leaving behind only the human readable text and numbers so that I can end up with a properly formatted file.
I would also like to replace the blanks in the columns with a 0.
I was looking at the Javascript and also jQuery map command which may be a solution but I am only a hobbyist programmer.
Here is an output screen of the info after uploading the file to a webpage using javascript:
I hope some kind soul(s) can help me and/or shed some light here.
Thank you kindly
Den
Here is a sample of the desired result (which I would like to get properly formatted as a csv when downloaded ) :
** CUTTING LIST **
CUSTOMER: MRS. ELLIE BLOM
ORDER NO: JOB NO:
NUMBER OF BOARDS REQUIRED: 3 BOARD SIZE: 2740 X 1820
TYPE OF MATERIAL: MEL WHITE 16MM 9X6 GRADE OF MATERIAL:
CUTTING FACTOR: 10 GRAIN: N
LENGTH WIDTH NUMBER EDGING(L) EDGING(W) HOLES
1080 300 6 1 1
568 300 8 1
568 100 6 1
1080 300 1 1 1
284 1080 1 1 1
284 284 4 1 1
720 450 2 1 1
568 450 3 1
568 100 2 1
450 360 2 1 1
568 450 2 1
568 100 2 1
870 560 2 1
868 560 2 1
868 100 3 1
870 560 2 1
568 560 2 1
568 100 3 1
178 594 1 2 2
538 596 1 2 2 2
TOTAL EDGING REQUIRED: 44,792m TYPE OF EDGING:
7/9/2022 3:30
Below is the link to the jsfiddle I created to upload the file and display it or print it and it also downloads a CSV file automatically once you upload a text file (input1.txt) which I am trying to upload here.
(I'm currently attempting to create a properly formatted csv from it, hence the question here.)
jsfiddle link
To get the above to work download the input1.txt file from here at
Github Link and upload it in the jsfiddle example.
What I have tried:
Regex
SED
pcl2ascii
pcl to pdf
ghostscript
more, type commands
hex editor
been reading up on PCL and ESC/p
printing emulation
and many more.