LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   i need a little help with the ls command (https://www.linuxquestions.org/questions/linux-newbie-8/i-need-a-little-help-with-the-ls-command-283074/)

Grafbak 01-27-2005 07:03 PM

i need a little help with the ls command
 
Hello all,

As for a hobby project i want to create a textfile of some files on my linux fileserver, but i need it to be in a certain format to import it in a database.
The server runs on knoppix 3.3.

I want to use the ls command for that, but i can't get it the way i want. :cry:

(URL could be something like //bigmofo1/linux/knoppix.iso)
I want to have it in this format : Filename, size, URL, date created.

If anyone can give me a hand i'd appreciate it very much, thank you :)

mjrich 01-27-2005 08:09 PM

Well, you could use awk with something along the lines of
Code:

ls -lh | awk '{printf "%s %s %s\n", $8, $5, $6}' > outputfile.txt
- though that won't give you the absolute path to each file. You could 'cat' on the output of pwd, presumably, though there might be a simpler way to do it...

Cheers,

mj

BrianW 01-27-2005 08:11 PM

You might want to take a look at the du command.

Grafbak 01-28-2005 06:26 AM

Thank you very much for the reply. I will have a look at the du command, after i have been studying the awk command. I have a need to understand why it behaves like this, i might even learn something :). I hope it works !!

Thnx again !


All times are GMT -5. The time now is 08:52 AM.