Hello guys,
I need some help with an Idea which I had today for a Script.. I am very new in this language and wanted to get a starting point for my script...
My Idea is that I have an txt File in a Folder with Website domains. As I start the Program, it should read these and sort them by their ending. For example there should be all gmails in a diffrent txt and all web and aol on diffrent txt files after the script finished..
Hope anyone have an Idea how to accomplish this kind a result..
Best regards
Matthias
Need Help with an Idea of an Sorting script
-
- Posts: 84
- Joined: 13 Mar 2020, 22:51
Re: Need Help with an Idea of an Sorting script
first learn the command FileRead to make the script to read the .txt probably
the command InStr checks if a string its in a variable(maybe that helps separating the info in the .txt)
also you can inform about expressions and how to use them(if you learn about them you can separate text), joe glines has videos about how to use them and examples like this:
https://www.youtube.com/watch?v=hmx-CGLBVSQ
but in his channel he probably has explains more
and then probably use some kind of loop command to make it check every line separately
and maybe you want to put the text in some place, in some .txt, for that the command FileAppend could help
i'm just sayin what i know
the command InStr checks if a string its in a variable(maybe that helps separating the info in the .txt)
also you can inform about expressions and how to use them(if you learn about them you can separate text), joe glines has videos about how to use them and examples like this:
https://www.youtube.com/watch?v=hmx-CGLBVSQ
but in his channel he probably has explains more
and then probably use some kind of loop command to make it check every line separately
and maybe you want to put the text in some place, in some .txt, for that the command FileAppend could help
i'm just sayin what i know
Re: Need Help with an Idea of an Sorting script
Hey adrian88888888,
thanks for your answer. I already know some commands like Fileread and InStr but I am confused how to make like a sort system and how to make that the the script will make a sorted output in txt like all .net domain in one .txt file...
Any Ideas how to make Many txt files automatically after the sorting?
best regards
Matthias
thanks for your answer. I already know some commands like Fileread and InStr but I am confused how to make like a sort system and how to make that the the script will make a sorted output in txt like all .net domain in one .txt file...
Any Ideas how to make Many txt files automatically after the sorting?
best regards
Matthias
Re: Need Help with an Idea of an Sorting script
Code: Select all
FileRead domains, domains.txt
Files := {}
Loop Parse, % domains, `n, `r
{
RegExMatch(A_LoopField, "@\K.*", domain)
if !Files.HasKey(domain)
Files[domain] := FileOpen(domain ".txt", "a")
Files[domain].WriteLine(A_LoopField)
}
e:fix logic error, thanks @hd0202
Last edited by swagfag on 03 May 2020, 06:14, edited 1 time in total.
Re: Need Help with an Idea of an Sorting script
Impressive, swagfag! It took me minutes to understand that I don't understand your code. My feeling tells me that it works. Your coding is always an inspiration!
Re: Need Help with an Idea of an Sorting script
if you do not want to loose the first website of each domain:
Hubert
Code: Select all
; FileRead domains, domains.txt
Files := {}
Loop Parse, % domains, `n, `r
{
RegExMatch(A_LoopField, "@\K.*", domain)
if Files.HasKey(domain)
Files[domain].WriteLine(A_LoopField)
else
{
Files[domain] := FileOpen(domain ".txt", "a")
Files[domain].WriteLine(A_LoopField)
}
}
Who is online
Users browsing this forum: Google [Bot], JKJadan, Psych0p4th and 262 guests