News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

I need a program called "FindLine"

Started by learn64bit, November 29, 2022, 04:41:33 AM

Previous topic - Next topic

sudoku

 
QuotefileName dw  "\\?\D:Win7m7\a.txt", 0
(removed formatting for better display here - was unicode string in the source)

Why the wildcard "\\?" before the drive letter?
comment in the source file:
Quote;By default, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, prepend "\\?\" to the path.
Okay, but then....

Are you sure you want to delete a.txt?
Now this I do noty understand. Are you simply trying to test DeleteFileW?

QuoteRetrouveMessageErreur
French??
Very curious, odd even.
:cool:

learn64bit

deleteEmptyFolderV391
(.zip\.asm&.cmd)

learn64bit

1. after deleteFile, now we have dupliLine problem again, haha
2. how to delete "sha256sum" + "space" from line. which Editor can do it?
3. how to delete "backslash" + "fileName" from line. which Editor can do it?

TimoVJL

If you use memory mapped files, you need to use buffers for removing unused data.
Look at masmbasic, if there are already usable functions for data processing, i you can't make a your own.
May the source be with you

learn64bit

delete sha256sum + space
(use EditPlusV3.51b1036)


correct

delete backslash + fileName


not correct

sudoku

Quote from: learn64bit on April 29, 2024, 11:00:49 PM1. after deleteFile, now we have dupliLine problem again, haha
2. how to delete "sha256sum" + "space" from line. which Editor can do it?
3. how to delete "backslash" + "fileName" from line. which Editor can do it?
The sha256sum plus space is always the same number of characters, should be easy to obtain just the filename having that knowledge. Just copy the filename into an appropriate sized buffer. The carriage return/line feed pair will tell you where the filename ends. Except for your last line, which you said cannot contain CRLF pair. In that case, look for the first zero after the path. If Unicode, look for the first double zero   (Hex: 00 00)

Why remove anything from their line? You are deleting every file on the list, correct?
Just delete the a/b/c/d or whatever .txt file when you have removed all the files on the list. Or just leave it.
For files that are not removed, make a separate list of those files.(the ones not removed for whatever reason) you can also make a note on that list why not removed, didn't exist, file in use, system file, or whatever.

Using yet another third party program? Should be easy enough to write your own, I would think. Or just a simple procedure to be used in existing code source file. Just some more tips for you to think about.
:cool:

learn64bit

delete sha256sum + space is for deleteFile app.
delete backslash + fileName is for deleteEmptyFolder app.
delete dupliLine is for deleteEmptyFolder app


third party app is ok.
delete emptyLine use third party app.
delete trailing 0Dh,0Ah use third party app

sudoku

Quote from: learn64bit on April 30, 2024, 12:12:03 AMdelete sha256sum + space is for deleteFile app.
delete backslash + fileName is for deleteEmptyFolder.
delete dupliLine is for deleteEmptyFolder


third party app is ok.
delete emptyLine use third party app.
delete trailing 0Dh,0Ah use third party app
Okay. It seems like you always take the long way to do these text manipulation duties. Even generating the sha256sum can be done in your own code (there exist libraries for that) as well as everything you have mentioned in this thread. Still you are making progress with your overall project (or seem to be) and I applaud your persistence.
:cool:

learn64bit

now the delete backslash + fileName is correct


now we only need the deleteDupliLine app

sudoku

To remove duplicate lines from a text file, it is much easier if it is sorted first.

Sorting lines of text should be easy. Hutch has some pretty good sorting algos  in the Masm32 SDK. With that sorted list, it is very easy to remove duplicate lines from it. Compare a given line with the next line, if duplicate do not copy it to output buffer else copy it to output buffer. I have a qeditor plugin that works in that fashion, so I know it is easy to code.
This can all be done in assembly. You haven't been interested in most of the example code I have presented {and removed because of your lack of interest} (with exception to the DeleteFile example) so I refrain from posting the code that I would use here. You definitely do not need a third party to do that for you. It wastes time, and for me it is more satisfying if I can do it myself. That is what coding is all about (for me). No satisfaction if a third party tool does the work for you. Unless of course, it is a truly complex task that needs to be handled. Nothing complex about removing duplicate lines of text.

Just some more 'food for thought' from me.
:cool:

learn64bit

e.txt and f.txt testFiles
(not everybody have the third party app, so I upload the result e.txt and f.txt testFiles)

jj2007

Quote from: TimoVJL on April 29, 2024, 11:18:54 PMLook at masmbasic, if there are already usable functions for data processing

There probably are, and they are fast, but after following 27 pages of this funny thread I still don't have the faintest idea what this guy wants or what he is doing :biggrin:

(yes I know it has something to do with finding lines in text files consisting of one Million zero bytes; right?)

Quote from: sudoku on April 30, 2024, 01:15:28 AMSorting lines of text should be easy

It is easy, indeed - but not fast. If I understand correctly, he has Millions of lines. Study the O(n) behaviour of sort algos...

sudoku

@jj2007

Yes, sorting can be slowish. Hutch has functionality in qeditor for either ascending sort and descending sort. Both are 'pretty fast', but yes even they (or qeditor) would choke if millions of lines in the editor.
And the zeros that may be present are indeed troublesome. No normal text or string handling functions will work with those zeros present.

Yes what he wants to do is evolving over time, and getting hard to follow (it was easy in the early stages) - he is now onto deleting scores (hundreds?, thousands?, millions?) of files.

[rant] My solution would be to not put that much junk on my computer in the first place. (Dozens of full versions of Visual Studio, for example - every conceivable version of Windows OS's is another example - he posted about both) pick one that works for you and be done with it, imo. You probably won't even use most of it anyway. [rant off]
:cool:

learn64bit

now we have dupliLine problem in f.txt, haha
a new app "deleteDupliLine" will come

jj2007

Quote from: sudoku on April 30, 2024, 01:31:57 AMYes what he wants to do is evolving over time, and getting hard to follow

There are wonderful translation sites like Deepl.com - I refuse to follow a guy who throws around bits and pieces of only partly useful and/or correct information, spread over 27 pages. Kudos that you are still playing his game :thumbsup: