I have a list of pathnames in file A.text then I want to get only filenames to B.text. For example,
File A.text
File B.text (should be)
How to do it ?
Thank in advance
I have a list of pathnames in file A.text then I want to get only filenames to B.text. For example,
File A.text
File B.text (should be)
How to do it ?
Thank in advance
la -A test_* > newfile.txt
or
la -A test_*
Thank you for your reply. The code that you gave is OK but If some filename is not start with test so what I should do?
The ls solution assumes the files exist. What if they don't?
awk -F/ '{ print $NF }' list_of_files.txt
Thank you again both of you. It's work !!
If you are building the first file with the names in it just so you can extract the filenames, then you could skip that step with this:
me@mine:~$ find ./foo -type f -exec basename {} \;
# This finds all files in my foo directory and 'basename' retrieves just the file part.