#33774 - 2002-12-01 10:16 AM
Stripping trailing spaces
|
Dog
Lurker
Registered: 2002-12-01
Posts: 2
Loc: Australia
|
I have a file generated from the mainframe which fills each line to 80 characters with spaces. The files can be around 100,000 lines which makes for a larger file than it should be. Each line of data is variable & can be from zero to 40 or 50 characters per line. Is there a way to have KiXtart remove these excess spaces. The file is read in by another app & is keeping the blank spaces in its database. I looked at RTRIM but couldn't quite master it. thanks
|
|
Top
|
|
|
|
#33775 - 2002-12-01 10:33 AM
Re: Stripping trailing spaces
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Hello and Welcome to the board.
Most of your text editors can do this very easily now days.
UltraEdit or TextPad as well as many others can do this very easily and much faster then KiXtart could perform the task.
UltraEdit http://www.idmcomp.com/
TextPad http://www.textpad.com/
|
|
Top
|
|
|
|
#33777 - 2002-12-01 10:39 AM
Re: Stripping trailing spaces
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Did not say KiX could not do it, just said text editors could do it FASTER and I still say they can do it faster.
|
|
Top
|
|
|
|
#33781 - 2002-12-02 11:37 AM
Re: Stripping trailing spaces
|
Dog
Lurker
Registered: 2002-12-01
Posts: 2
Loc: Australia
|
thanks all, KiXtart will do the job however as was stated is too slow for a large file. It would work well for some smaller files. Below is the script that was tested & worked if anyone needs it.
IF Open(1,"c:\temp\Filein.txt",2) = 0 Open (2,"c:\temp\Fileout.txt",5) $x = ReadLine(1) WHILE @ERROR = 0 $y = Rtrim($x) + chr (10) Writeline (2,$y) $x = ReadLine(1) LOOP Close (1) Close (2) ENDIF
|
|
Top
|
|
|
|
#33784 - 2002-12-10 12:52 AM
Re: Stripping trailing spaces
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
In an earlier edition of Ruud's manual (= KiXtart 4.10) you can read as remark on Open function quote:
The file-I/O functions in KiXtart (OPEN, READLINE, and CLOSE) process small configuration files. They are not intended for larger operations, such as scanning long files. For the sake of simplicity and speed, OPEN reads an entire ASCII file into memory, and subsequent READLINE commands read lines stored in memory.
Although this design is memory-intensive, it is also very fast and simple.
greetings.
|
|
Top
|
|
|
|
#33786 - 2002-12-09 02:42 PM
Re: Stripping trailing spaces
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Lonkero,
It is just "what is an acceptable service for someone". Also it isn't always possible to handle it in an easy way. At this moment it can be hard for kixtart to read lines with a length 250.000 characters. Also we shouldn't forget that I/O opera- tion can be very CPU intensive.
We prefer a higher program language to do the job, when we want to analyze file contents on a regular base. Sometimes we had to deal with nearly 500 MB of data for the preparation of our statistical pages. We wouldn't like to wait for about 1 or 2 hours for one simple run. Now it cost only 3/4 minutes to do the job.
A good comparison was made in the past during developping our kixstrip tool. The response time between a kixtart variant and our tool was dramatical. greetings.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|