LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   List files without path (https://www.linuxquestions.org/questions/programming-9/list-files-without-path-389541/)

mijohnst 12-05-2005 02:21 PM

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!

schneidz 12-05-2005 02:32 PM

'man basename'

i think it's:
Code:

basename /path/to/file
hth

mijohnst 12-05-2005 03:09 PM

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!


All times are GMT -5. The time now is 04:06 AM.