I'm hoping someone can assist with the following. I have a psftp text file contains a lot of gibberish.
Code: Select all
Remote directory is now /xjp/utility/CapEx/Inbound/Program
psftp> ls *.csv
Listing directory /xjp/utility/CapEx/Inbound/Program
-rw-r--r-- 1 iqtrack pcfd 0 Jan 6 15:06 program2.csv
-rw-r--r-- 1 iqtrack pcfd 0 Jan 6 15:06 program5.csv
psftp> cd /xjp/utility/CapEx/Inbound/Program/ProgFinancial/
Remote directory is now /xjp/utility/CapEx/Inbound/Program/ProgFinancial
psftp> ls *.pdf
Listing directory /xjp/utility/CapEx/Inbound/Program/ProgFinancial
-rw-r--r-- 1 iqtrack pcfd 0 Jan 6 15:06 Financial_Analysis_program2.pdf
-rw-r--r-- 1 iqtrack pcfd 0 Jan 6 15:06 Financial_Analysis_program5.pdf
psftp> cd /xjp/utility/CapEx/Inbound/Project/
Remote directory is now /xjp/utility/CapEx/Inbound/Project
psftp> ls *.csv
Listing directory /xjp/utility/CapEx/Inbound/Project
-rw-r--r-- 1 iqtrack pcfd 0 Jan 6 15:06 project1.csv
psftp> cd /xjp/utility/CapEx/Inbound/Project/ProjFinancial/
Remote directory is now /xjp/utility/CapEx/Inbound/Project/ProjFinancial
psftp> ls *.pdf
Listing directory /xjp/utility/CapEx/Inbound/Project/ProjFinancial
-rw-r--r-- 1 iqtrack pcfd 0 Jan 6 15:06 Financial_Analysis_project1.pdf
psftp> quit
I want to search for following line of string in a text file that contains "-rw-r--r--" and parse out the filename so it can vary from project1.csv or Financial_Analysis_project1.pdf, etc.
for example I'd read in the following line of string
Code: Select all
-rw-r--r-- 1 iqtrack pcfd 0 Jan 6 15:06 project1.csv
and parse out
Code: Select all
project1.csv
Is this doable or am I reaching?
thanks