LinuxQuestions.org
Visit Jeremy's Blog.
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 04-29-2010, 06:49 AM   #1
riteshanand40
LQ Newbie
 
Registered: Dec 2007
Posts: 14

Rep: Reputation: 0
Name and details of file needed


Hi,

I have a file structure say in form of
/usr/local/a/ab/abc/abcd/abcd56365245128481284

there are millions of files arranged in such form .
I need only (ls -l) details of the individual files eg: abcd56365245128481284.

I tried ls -lRt /usr/local , but output file need very much editing to get required info in one file.

Can anybody help please!!

Regards,
Ritesh Anand
 
Old 04-29-2010, 06:59 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
find /usr/local -type f -name abcd56365245128481284 -exec ls -l {} \;
 
Old 04-29-2010, 07:08 AM   #3
riteshanand40
LQ Newbie
 
Registered: Dec 2007
Posts: 14

Original Poster
Rep: Reputation: 0
Hi,

File name is different for all files.
Some examples:
h/ho/hoe/hoex/hoex0A2F822B01278BB82C8708AC
d/dj/djp/djpi/djpi0A2F822B01278BB82C87429F
k/ki/kid/kidj/kidj0A2F822B0127BD6B5EEE68B6
x/xj/xjr/xjrl/xjrl0A2F822B0127BD7AFC1DB935
v/vh/vhk/vhkk/vhkk0A2F822B0127DCC0F4864893
z/zi/zij/zijz/zijz0A2F822B01281534DC20F206

I need ls -l info for the files only.

Ritesh A.
 
Old 04-29-2010, 07:21 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
How do you know which files you want the ls -l output for?
 
Old 04-29-2010, 07:27 AM   #5
riteshanand40
LQ Newbie
 
Registered: Dec 2007
Posts: 14

Original Poster
Rep: Reputation: 0
The files are arranged in the alphabetical order as shown above.

first 4 letter of file constitute the path
eg for file "hoex0A2F822B01278BB82C8708AC"
path is /usr/local/data/h/ho/hoe/hoex/hoex0A2F822B01278BB82C8708AC

I need ls -l info for the all the files only.
 
Old 04-29-2010, 07:34 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
You mean you want ls -l for all the files under <some directory> or do you mean only for the ones where the first 4 letters are the same as the name of the directory they are in?
 
Old 04-29-2010, 07:36 AM   #7
riteshanand40
LQ Newbie
 
Registered: Dec 2007
Posts: 14

Original Poster
Rep: Reputation: 0
No i want ls -l info in a file for all such files.
 
Old 04-29-2010, 07:36 AM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
find /usr/local/data -type f -ls

Do you want the directory information stripped of and ignore directories?

ls -lR /usr/local/data | grep '^-'

This assumes you want to ignore links and device files as well.

That is an odd way to by organize files since
/usr/local/data/hoex/hoex0A2F822B01278BB82C8708AC
/usr/local/data/djpi/djpi0A2F822B01278BB82C87429F
etc., would result in the same number files per directory.

Last edited by jschiwal; 04-29-2010 at 07:40 AM.
 
Old 04-29-2010, 07:39 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by riteshanand40 View Post
No i want ls -l info in a file for all such files.
Which we cannot tell you how to do until you define "such files" to us. Until then we are only guessing.
 
Old 04-29-2010, 07:56 AM   #10
riteshanand40
LQ Newbie
 
Registered: Dec 2007
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
find /usr/local/data -type f -ls

Do you want the directory information stripped of and ignore directories?

ls -lR /usr/local/data | grep '^-'
Thanks i got what i was looking for..Thanks a lot.
 
Old 04-29-2010, 08:18 AM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Glad you found a solution

The Thread Tools menu can be used to mark the thread SOLVED.
 
  


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
Details on using Mysql with ruby, project struck ,needed help asap! wrapster Programming 2 07-27-2009 09:44 PM
read a line from text file and extracting the details needed pdklinux79 Linux - Newbie 6 06-06-2008 11:41 PM
SLED10 license & package details needed shamrock_uk SUSE / openSUSE 2 07-18-2006 03:03 PM
Details needed on Linux programming Certifications fithil Linux - Certification 3 07-12-2006 03:49 PM
Setting up and configuring Wine, Details needed. Poneyboy Linux - Software 1 05-06-2006 11:53 PM

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

All times are GMT -5. The time now is 04:48 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