Recent

Author Topic: filehandling text  (Read 3901 times)

frederic

  • Full Member
  • ***
  • Posts: 226
filehandling text
« on: August 02, 2017, 02:21:08 pm »
dear specialists

i have text files with  .txt and text files with  .prn extensions
is there a difference to look after

ps i want tosplit files because the are too big
frederic

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: filehandling text
« Reply #1 on: August 02, 2017, 02:24:09 pm »
the extention of a file is pointless ... the contents matters
.prn files are print files in general .. open them in an editor and take alook of the content .. it can be postscript or other printer related format ( also .ps is used for postscript )
Speak postscript or die!
Translate to pdf and live!

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: filehandling text
« Reply #2 on: August 02, 2017, 05:07:41 pm »
the extention of a file is pointless ... the contents matters
I know what you mean, Blestan, but someone who doesn't yet know the difference between a .PRN and .TXT file could misunderstand.

In general, the extension means a great deal - indicating the type of file and therefore which program can 'use' it.  (though that can be abused)

Quote from: Blestan
.prn files are print files in general .. open them in an editor and take a look at the content .. it can be postscript or other printer related format ( also .ps is used for postscript )
Properly used, a .PRN file contains not just the text/images to be printed, but also all the control codes 'specific' to the printer it was created for,  ie. you can't just output a .PRN file created for (say) an Epson colour inkjet to a (say) Cannon inkjet, and certainly not to a Laser Printer. Lasers are generally not so fussy since they pretty much all understand PCL (in whatever version).  It would be incorrect to create a PostScript file with a .PRN extension, .PS is the standard.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: filehandling text
« Reply #3 on: August 02, 2017, 05:24:47 pm »
i can assure you that when you generate an printing file from lets say corel draw the default extention is prn and the content is postscript ;)
Speak postscript or die!
Translate to pdf and live!

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: filehandling text
« Reply #4 on: August 02, 2017, 05:56:16 pm »
i can assure you that when you generate a printing file from lets say coreldraw the default extension is prn and the content is postscript ;)
Only if the selected printer is a PostScript device.

If the selected printer was an Epson InkJet then it wouldn't be  - -  unless Epson have changed since I wrote printer drivers back in the 90s  :)
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: filehandling text
« Reply #5 on: August 02, 2017, 06:03:26 pm »
thats what i say - file extention is meaningless ... prn content can be whatever the program that generates it wants
Speak postscript or die!
Translate to pdf and live!

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: filehandling text
« Reply #6 on: August 02, 2017, 06:08:26 pm »
i have text files with  .txt and text files with  .prn extensions
is there a difference to look after
So, what program generated the .txt and .prn files?

Quote
ps i want tosplit files because the are too big
Depending on what the content is (and what program generated them) splitting them might not be advisable?

What do you intent to do with the split files?
If it's just for storage or transfer, why not zip of 7zip them. They will be much much much smaller that way.

frederic

  • Full Member
  • ***
  • Posts: 226
Re: filehandling text
« Reply #7 on: August 13, 2017, 01:49:32 pm »
first
i am sorry guys to answer so late ,thanks for your reactions

the original reason was that different programs were generating and using  different file extensions and i have to adapt for them when using data from or feed data to these projects .(suppliers specification)
in the meantime however i standarized  the input( and output)  for my own project on .txt and simply adapt the name of te file when needed.
Quote
ps i want to split files because the are too big

the reason was that up till now i have  used  stringlist to open big files (> 70mb) ,and  had put data in arrays ( data are  30 -50 parameters on a one minute base over more then 20 years resulting in too big arrays and very slow and memory problems.
I was forced to split the files by hand

It may be that using Tfilestream for picking data (used for statistical calculations)is the better option here .

Some time ago i standarized the storage (size per day) , but still using Tstringlist. 
So splitting the file in smaller parts ,the same idea as Tfilestream is using buffers.

frederic

Almir.Bispo

  • Jr. Member
  • **
  • Posts: 91
  • CSV Comp DB is the Best NoSQL
    • CSV Comp DB (NoSQL)
Re: filehandling text
« Reply #8 on: August 13, 2017, 03:34:42 pm »
What format of this files?Can you paste a exemple?
80 MB is not to large file.What RAM Memory in your system.
I have a System to handle text files (csv format, semi colon delimited).
CSV Comp DB Developer {Pascal Lover}

frederic

  • Full Member
  • ***
  • Posts: 226
Re: filehandling text
« Reply #9 on: August 13, 2017, 05:26:55 pm »
Almir.Bispo,
Quote
What format of this files?Can you paste a exemple?
80 MB is not to large file.What RAM Memory in your system.
I have a System to handle text files (csv format, semi colon delimited).

all started with a laptop with 1GB  ram , but also other pc's with 2gb had problems with it.

a csv format, semi colon delimited sytem is included in the present (day based system) and that works perfect for my purpose
an example of the format is included in the attachment(remark: a very short section(both in time and number of parameters) and for testing reasons; a few minutes per day)



but i am now testing another way by using tstream but that  uses a memo in order to be able to read  a date as starter for a splitting action . I learned ,in the mean time,. that the max memo width could become a problem when the number of  items in a line is too big for a complete memoline
I rather like to do the same thing directly in the filestream .But i don't know how to do that(especially when the number of lines per day vary).
frederic


Almir.Bispo

  • Jr. Member
  • **
  • Posts: 91
  • CSV Comp DB is the Best NoSQL
    • CSV Comp DB (NoSQL)
Re: filehandling text
« Reply #10 on: August 13, 2017, 07:29:27 pm »
you can use CSV Comp DB to manipulate it.Very fast NoSQL.ou can find any data using CQL Query Language:
You can embedded and create Big App.(Can you use sdfdataset Lazarus  component )
Code: Javascript  [Select][+][-]
  1. //exemple how to find an ocurrence
  2. {
  3.  csv_table;
  4. @algo;
  5. (Data_to_find);
  6. 0;
  7. 0;
  8. 0;
  9. query=0;
  10. destino=0
  11. }
  12. //exemple how split fields (5 or 15 seconds)
  13. {
  14.  csv_table;
  15. @Listar;  
  16. 0;
  17. 0;
  18. 0;
  19. 0;
  20. query=0;
  21. destino=0
  22. }
  23.  

http://adltecnologia.blogspot.com.br

Application exemple:
https://www.youtube.com/watch?v=LcQIFCNKPFU
CSV Comp DB Developer {Pascal Lover}

Almir.Bispo

  • Jr. Member
  • **
  • Posts: 91
  • CSV Comp DB is the Best NoSQL
    • CSV Comp DB (NoSQL)
Re: filehandling text
« Reply #11 on: August 13, 2017, 08:05:52 pm »
A pratical exemple with your test file
You can embbed in Pascal Code too.

The time is about ~3 ms to your test file

Operational System latency:(ms) 1505
     *      *     *      Start    *     *      *     *
 Date:13/08/2017    Time:14:56:06    Elapsed (s):0,0000000000

*  *  *  Execution Process Resume  *  *  *
 Date:13/08/2017    Time:14:56:06    Elapsed (s):0,0002973934

You can do that in milions registers (The time to 1 milions register is about 7 seconds)
CSV Comp DB Developer {Pascal Lover}

frederic

  • Full Member
  • ***
  • Posts: 226
Re: filehandling text
« Reply #12 on: August 14, 2017, 09:28:24 am »
thanks  amir for your suggestionl

for the time being will stick to to the filestream alternative which offers also  oppertunitys in my further dataprocessing
frederic

 

TinyPortal © 2005-2018