How to edit a Text file in MAX?
Hi there
I would like to find a way to edit some text files automatically.
For example if I have this text in my text files, I want to extract the number in between "toilets" and "times":
Text file 1:
"Robert has been to the toilets 200 times today"
result: "200"
Text file 2:
"Robert has been to the toilets 22 times today"
result: "22"
Anyone knows how to do that???
Many thanks
Jon
--
Since what you want to do isn't really well described, I'd suggest that you take a look at the zl object [which would let you group, split, output and concatenate lists] or the route object [which will strip off something you watch for and pass the rest along] or the regexp objects [which will do all kinds of UNIX-style searche/replace operations].
Try looking at those objects as a start....
maybe this could help you...
Max is probably one of the worst tools for this job, after perhaps MS Paint. Have you thought about using some Javascript?
Thanks Gregory.
Sorry for not being too clear.....here is what I'd like to achieve:
I am using a text file generated from an URL page source (myspace page). I am trying to extract a data from this page source which is the number of profile views.
What I want to do is to be able to extract the number that is next to the "profile views" part in the text.
For example, I want to remove everything but the number "26563" below, how do I do that?? :
bgcolor="#ffffff" class="text">
yes it is yes it is yes it is oh yes it is
Leeds/LA/Grenoble/Northampton, London and South East
United Kingdom
Profile Views:
26563
Last Login:
01/02/2010
this would be my attempt to solve it.
but I still have the feeling that it isn't the perfect way of doing it.
If you're grabbing the source with [jit.uldl] then try something like this.
lh
Haha you only needed to post the link! The problem was the spaces between the "Profile Views:" and the actual number is a non-breaking space which in html is
thanks mate, yeah it works perfectly now!
Good work!!
Best wishes to all
Jon
the [text] object, some zl and some sprintf ist really all you need.