LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-27-2005, 07:03 PM   #1
Grafbak
Member
 
Registered: Jun 2003
Location: /dev/null
Distribution: Knoppix 3.3
Posts: 61

Rep: Reputation: 15
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.

(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
 
Old 01-27-2005, 08:09 PM   #2
mjrich
Senior Member
 
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

Rep: Reputation: 45
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
 
Old 01-27-2005, 08:11 PM   #3
BrianW
Member
 
Registered: Jul 2003
Location: Montana
Distribution: Slackware
Posts: 261

Rep: Reputation: Disabled
You might want to take a look at the du command.
 
Old 01-28-2005, 06:26 AM   #4
Grafbak
Member
 
Registered: Jun 2003
Location: /dev/null
Distribution: Knoppix 3.3
Posts: 61

Original Poster
Rep: Reputation: 15
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 !
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
Why after start of a command the invitation for input next command has not appeared. ukrainet Linux - General 3 06-24-2005 08:16 AM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 07:14 PM
Where is Command line utility for Cups and command tutorial mossy Linux - Software 8 01-16-2004 12:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration