Jump to content

Extracting colon delimiter from large file


Recommended Posts

#Include <file.au3>
#Include <Array.au3>
Local $nobrainArray
$var = _FileReadToArray("example.txt", $nobrainArray)
$split = StringSplit($var, ":"); split by colon?
    _ArrayDisplay($split)

Its getting later and I am getting more and more tired so I think I should go to bed and give this another look tmr.
but if someone could help me i'd be grateful!

 

randomfirstname:randomlastname\nrandomfirstname:randomlastname\nrandomfirstname:randomlastname\nrandomfirstname:randomlastname\nrandomfirstname:randomlastname\nrandomfirstname:randomlastname\nrandomfirstname:randomlastname\nrandomfirstname:randomlastname\nrandomfirstname:randomlastname\n----------------------------------------------------------------------\n\nThe topic can be found here:\nhttps://www.websitehere.com\n\n\nYou can unsubscribe at any time here: https://www.websitehere.com/unsubscribe/Zm9ydW1zO2ZvcnVtczs0MzszOTc0MTA7Mzk3NDEwO25pa29sYXppbmRvQGdtYWlsLmNvbQ,,/\n\nIf you are not following any forums and wish to stop receiving notifications, uncheck the setting\n\"Send me news and information\" found in \'My Settings\' under \'Notification Options\'.\n',545627,'followed_forums','https://www.websitehere.com/topic/','forums','forums',43,'4745c9f0607baec3e8bc38f47d07f9bd'),(622776,49813,1457299052,1,'<a href=\'https://www.websitehere.com/!545627\'>Antepliemmo</a> posted topic <a href=\'https://www.websitehere.com\'>\n\n----------------------------------------------------------------------\n

As you can see this is very messy!
There is random first names and last names everywhere and then there is a lot of junk....
I am extracting all the names/last names for a buddy, but I just can't seem to figure it out.

Any help is appreciated, I'll keep working on this tomorrow again wish a fresh mindset!
 

Regards

Ryuk

Link to comment
Share on other sites

Another example.

#include <Array.au3>

;ConsoleWrite(StringRegExpReplace(FileRead(@ScriptName), "(?s)^.*#cs\v*|\v*#ce.*$", "") & @LF)

;$var = StringReplace(FileRead("example.txt"), "\n", @crlf) ; For use if "example.txt" file is available.
; or
$var = StringRegExpReplace(FileRead(@ScriptName), "(?s)^.*#cs\v*|\v*#ce.*$", "") ; For use in this example only where data is between #cs and #ce

$res = StringRegExp($var, '(?i)([a-z\h\-\.]+:[a-z\h\-\.]+)\\n', 3)

_ArrayDisplay($res)

#cs
randomfirstnameA:random de lastnameA\nrandomfirstnameB:randomlast-nameB\nrandomfirstnameC:randomlastnameC\nrandomBillie-JoD:randomlastnameD\nrandomfirstnameE:random lastnameE\nrandomfirstnameF:randomlastnameF Jr.\nrandomfirstnameG:randomlastnameG\nrandomfirstnameH:randomlastnameH\nrandomfirstnameI:randomlastnameI\n----------------------------------------------------------------------\n\nThe topic can be found here:\nhttps://www.websitehere.com\n\n\nYou can unsubscribe at any time here: https://www.websitehere.com/unsubscribe/Zm9ydW1zO2ZvcnVtczs0MzszOTc0MTA7Mzk3NDEwO25pa29sYXppbmRvQGdtYWlsLmNvbQ,,/\n\nIf you are not following any forums and wish to stop receiving notifications, uncheck the setting\n\"Send me news and information\" found in \'My Settings\' under \'Notification Options\'.\n',545627,'followed_forums','https://www.websitehere.com/topic/','forums','forums',43,'4745c9f0607baec3e8bc38f47d07f9bd'),(622776,49813,1457299052,1,'<a href=\'https://www.websitehere.com/!545627\'>Antepliemmo</a> posted topic <a href=\'https://www.websitehere.com\'>\n\n----------------------------------------------------------------------\n
#ce

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...