Jump to content
UBot Underground

Get Lines From Text File With Regex


Recommended Posts

what i want to do is get what ever line from a text file

 

i know how to use list to get it but i want to use regex and text file only

 

i have a text file that has numbers like this in it

 

1092880787
1815132654
1940572
1508015041
100009639188331
31105080
100000190745991
655229634
100003094469917

 

i want to set numbers in a variable and i want to get it from a text line

 

i can get the first line like this now

 

set(#row1,$find regular expression($list from file("c:\\numbers.txt"),"\\A.*"),"Global")

set(#test,"whats up {#row1} my number ","Global")

 

this is how i want it

 

whats up 1092880787 my number

 

 

i can also get other lines too like this

 

set(#row5,$find regular expression($list from file("C:\\numbers.txt"),"(.*)(?=(\n.*)\{5\}$)"),"Global")

set(#test,"whats up {#row5} my number ","Global")

 

but that breaks the line and my output looks like this

 

whats up 100009639188331

my number

 

 

is there a command like

\A.*

so i  can get the second, third, forth and so on

Link to post
Share on other sites

no only numbers, if there is something else besides regex thats fine

 

but i dont want to add it to a table or to a list

 

just want to pull it from the text file

 

if there was a way to delete the first line after getting it than that would work too

Link to post
Share on other sites

You can use this plugin to read part of a file: http://www.ubotstudio.com/forum/index.php?/topic/15579-free-plugin-advanced-file-clipboardhandle-big-lists-in-text-files-and-more/

 

Just read one line at a time I guess.

 

Why don't you just want to use a list though? That is normally the right way to do it.

  • Like 1
Link to post
Share on other sites

thanks i think that should work, but the reason why i dont wan to do a list or a table is because ive been having some problems with it in multithread

 

eaiser to write the files to disk with a random file name and read it from there

 

 

Thanks

Link to post
Share on other sites

here is an alternative

 

save to file("{$special folder("Desktop")}\\test-read.txt""1092880787
1815132654
1940572
1508015041
100009639188331
31105080
100000190745991
655229634
100003094469917")
alert($list item($list from text($read file("{$special folder("Desktop")}\\test-read.txt"), $new line), 4))

 

 

CD

  • Like 1
Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...