Hello guys,
I've been trying to write an awk script that reads a text file that contains directory paths (I'll call it "path.txt") what's inside path.txt is a listing of directory structures something like this:
/home/Tabitha/girly1/ <--- the wanted file "redhead.txt" is in this directory
/home/Tabitha/girly1/wanted_file_not_in_here/
/home/Tabitha/girly1/wanted_file_not_in_here_either/
/home/Tabitha/girly2/ <--- the wanted file "redhead.txt" is in this directory
/home/Tabitha/girly2/wanted_file_not_in_here/
/home/Tabitha/girly2/wanted_file_not_in_here_either/
/home/Tabitha/girly3/ <--- the wanted file "redhead.txt" is in this directory
/home/Tabitha/girly3/wanted_file_not_in_here/
/home/Tabitha/girly3/wanted_file_not_in_here_either/
there's a bunch and bunches of these, way more than just three
only inside the "shortest" directory path will have the filename that I'm really after I'll say, "redhead.txt" and I want to add the "redhead.txt" to the end of the directory path that it came from so when I'm done I'll have a new_path_file.txt that will look like this
/home/Tabitha/girly1/redhead.txt
/home/Tabitha/girly2/redhead.txt
/home/Tabitha/girly3/redhead.txt
so what I've been trying so far, but I can't get it to work is
first do a find . -name "redhead.txt" on the Tabitha directory
then send that to print $0
what I'm having trouble with is read in path (been trying getline), add redhead.txt to the end (been trying cat) loop thru the bunches of files (been trying a for loop like in C)
THANK YOU SOOOOOO MUCH to whoever will help me, Tabby
I've been trying to write an awk script that reads a text file that contains directory paths (I'll call it "path.txt") what's inside path.txt is a listing of directory structures something like this:
/home/Tabitha/girly1/ <--- the wanted file "redhead.txt" is in this directory
/home/Tabitha/girly1/wanted_file_not_in_here/
/home/Tabitha/girly1/wanted_file_not_in_here_either/
/home/Tabitha/girly2/ <--- the wanted file "redhead.txt" is in this directory
/home/Tabitha/girly2/wanted_file_not_in_here/
/home/Tabitha/girly2/wanted_file_not_in_here_either/
/home/Tabitha/girly3/ <--- the wanted file "redhead.txt" is in this directory
/home/Tabitha/girly3/wanted_file_not_in_here/
/home/Tabitha/girly3/wanted_file_not_in_here_either/
there's a bunch and bunches of these, way more than just three
only inside the "shortest" directory path will have the filename that I'm really after I'll say, "redhead.txt" and I want to add the "redhead.txt" to the end of the directory path that it came from so when I'm done I'll have a new_path_file.txt that will look like this
/home/Tabitha/girly1/redhead.txt
/home/Tabitha/girly2/redhead.txt
/home/Tabitha/girly3/redhead.txt
so what I've been trying so far, but I can't get it to work is
first do a find . -name "redhead.txt" on the Tabitha directory
then send that to print $0
what I'm having trouble with is read in path (been trying getline), add redhead.txt to the end (been trying cat) loop thru the bunches of files (been trying a for loop like in C)
THANK YOU SOOOOOO MUCH to whoever will help me, Tabby