forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Newbie question - Text to single column - back again

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Capinha
Newbie


Joined: 19 Oct 2006
Posts: 13
Location: Portugal

PostPosted: Thu Oct 19, 2006 8:42 pm    Post subject: Newbie question - Text to single column - back again Reply with quote

Hello there, i'm very fresh with VDS and i'v download'it because i'm trying to build a script were i convert a text file like this:

123 222 333 444
111 222 333 555...

in something like this:

123
222
333
444
111
222
333
555
...

and if possible the return this new text file to it's original format.

Is it possible?
Any ideias where to start?

Best regards

_________________
César Capinha
Back to top
View user's profile Send private message Send e-mail
kOt
Contributor
Contributor


Joined: 19 Jan 2004
Posts: 89
Location: Fyffe, AL

PostPosted: Fri Oct 20, 2006 2:32 am    Post subject: Reply with quote

if spaces is the only separaters then you could use something like this

Code:

# create a sample list with original layout
list create,1
list loadfile,1,sample.txt

#create a empty list
list create,2
%b = @count(1)
%y = 0
info %b - %y
repeat
  %y = @succ(%y)
  %z = 1
  %a = 1
  repeat
    if @equal(@substr(@item(1),%a,%a)," ")
      %%str = @substr(@item(1),%z,@fsub(%a,1))
      list add,2,%%str
      %z = @fadd(%a,1)
      %a = @succ(%a)
    elsif @equal(%a,@len(@item(1)))
      %%str = @substr(@item(1),%z,%a)
      list add,2,%%str
      %z = @fadd(%a,1)
      %a = @succ(%a)
    else
      %a = @succ(%a)
    end
  until @equal(@len(@text(1)),%a)
  %p = @next(1)
until @equal(%y,%b)
list savefile,2,newlayout.txt

_________________
Visual Dialogscript 5
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Capinha
Newbie


Joined: 19 Oct 2006
Posts: 13
Location: Portugal

PostPosted: Mon Oct 23, 2006 4:48 pm    Post subject: Thanks! Reply with quote

Tanks, í've tried it and it works great!

your the man Wink

Why not develop a software for translating GIS raster formats in ASCII to single columns and then rebuild the same file with predicted os statsitic values... there are some need out there...

Best wishes

César

_________________
César Capinha
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group