ok here it is. my attempt at parsing this results in alot of code. im gonna supply a picture of what i need done. each section of red in the picture is what needs to be parsed. as soon as they are each one is parsed individually i will do what i need with it so i dont need to preserve the buffer it goes into. reuse of the buffer is one thing i really need help with.
data db "dr-xr-xr-x   1 owner    group       0 May 21  2001 deskapps",13,10,

"dr-xr-xr-x 1 owner group 0 Apr 20 2001 developr",0
Posted on 2002-02-02 11:44:41 by smurf
Rather than doing ls -ltr, do this:
ls -ltr | tr -s ' ' | cut -d ' ' -f1,3-9

Should get what you want....
If you want to print it out nicer, then do this:
printf "Owner rights %s\t-\tOwner %s\nGroup %s\nSize %s\nDate %s %s %s\nDirectory/file name %s\n" `ls -ltr | tr -s ' ' | cut -d ' ' -f1,3-9`

I love the unix command prompt!

Mirno
Posted on 2002-02-02 16:16:55 by Mirno
mirno if im not mistaken you posted a command i can use to send to a server so that the string i need parsed will be parsed for me once i issue that command? well technically its not being parsed but just sending me the info i need in sections.. well thats what im thinking. but anyways can you expand on what exactly that command is and can i issue it with a windows server?
Posted on 2002-02-02 16:26:10 by smurf
ls is the unix directory listing command, and with the arguments -ltr gives a detailed description (ie the owner, last modified, size etc. check the man pages on any unix system for a complete description).

In unix you can pipe the results of one command into another, so "ls -ltr | less" will allow you to scoll up and down the resulting list if its over a page long (less is a good "text viewer" type tool).

In this case, I pipe the results of the ls -ltr into tr -s ' ' which will reduce all instances of string1 (in this case a space - ' ') to just a single instance of that string. Basically we will strip out multiple spaces, so we can use space as our field delimiter later on!

The result of that is then piped into a cut statement, which allows us to separate the fields using the -d to specify our delimiter (a space - ' '), and the fields we want, -f1,3-9 - this means we want fields 1, 3, 4, 5, 6, 7, 8, 9. It is important to remember that the date is separeted into month, date, year because they are space delimited.

If it is a unix system that you are issuing the ls -ltr command to, then you can also do this piping too.

Mirno
Posted on 2002-02-02 17:32:02 by Mirno
This looks very much like commands to send to a ftp server. Many
ftp servers only allow a *very* limited set of binaries being run...
so I would not depend on "cut" or whatever.
Posted on 2002-02-03 16:37:53 by f0dder