LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-05-2005, 02:21 PM   #1
mijohnst
Member
 
Registered: Nov 2003
Location: Huntsville, AL
Distribution: RHEL, Solaris, OSX, SuSE
Posts: 419

Rep: Reputation: 31
List files without path


I'm trying to run a SUM on some files and I'm trying to figure out how to list them in a certain way.

If I have three 4 files:

/tmp/test1
/home/test2
/user/local/bin/test3
/root/test4


And I want to do a sum on them:

find / -name test* | xargs sum | awk ' {print $1, $2, $3} '

48946 1 /tmp/test1
19974 2 /home/test2
59667 3 /user/local/bin/test3
40093 2 /root/test4


How do I get it to list only the file name and not where it resides?


48946 1 test1
19974 2 test2
59667 3 test3
40093 2 test4


Thanks again!

Last edited by mijohnst; 12-05-2005 at 02:23 PM.
 
Old 12-05-2005, 02:32 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
'man basename'

i think it's:
Code:
basename /path/to/file
hth

Last edited by schneidz; 12-05-2005 at 02:34 PM.
 
Old 12-05-2005, 03:09 PM   #3
mijohnst
Member
 
Registered: Nov 2003
Location: Huntsville, AL
Distribution: RHEL, Solaris, OSX, SuSE
Posts: 419

Original Poster
Rep: Reputation: 31
Thanks Schneidz... I'm playing with it right now... Seems like what I'm looking for if I could only get it to work now!
 
  


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
Could not init font path element unix/:7100, removing from list! jeffreybluml Fedora 18 10-12-2011 08:06 AM
How to list files from a certain user?? Drunkalot Linux - General 1 06-20-2005 05:11 AM
How to specify path for header files? farry Programming 4 04-06-2005 03:22 PM
list only files and not descend twantrd Solaris / OpenSolaris 2 11-29-2004 04:15 PM
mkisofs and specifying a path-list buttersoft Linux - Software 1 11-16-2003 09:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:36 PM.

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
Open Source Consulting | Domain Registration