Sample Header Ad - 728x90

How can I output a txt file, that has part of filename followed by path of file for all files in a folder, one line per file?

0 votes
4 answers
786 views
I have the following files
/folder/abc1.txt.gz
/folder/abc2.txt.gz
/folder/abc3.txt.gz
I would like to make a txt file with the following
abc1 /folder/abc1.txt.gz
abc2 /folder/abc2.txt.gz
abc3 /folder/abc3.txt.gz
I have used the following command
find /folder -name 'abc*.txt.gz' -type f -printf '%f %p\n' > out.txt
This will output:
abc1.txt.gz /folder/abc1.txt.gz
abc2.txt.gz /folder/abc2.txt.gz
abc3.txt.gz /folder/abc3.txt.gz
How can I have only the first part of the filename (without .txt.gz) folowed by the path?
Asked by christoforos giatzakis (1 rep)
Dec 15, 2021, 11:00 AM
Last activity: Dec 15, 2021, 06:21 PM