Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get the second last field...

Status
Not open for further replies.

h3nd

Programmer
Jul 1, 2006
147
AU
Hi guys,

I've got data like this :
Code:
./sirs_extracts/data@20060707.csv
./sirs_extracts/sirs@20060707.csv
./sirs_extracts/data@20060729.csv
./sirs_extracts/sirs@20060729.csv
./sirs_extracts/sirs@20060702.csv
./sirs_extracts/sirs@20060703.csv
./sirs_extracts/sirs@20060704.csv
./market_rates/historical_rates/data@20060707.csv
./market_rates/historical_rates/sirs@20060707.csv
./market_rates/historical_rates/data@20060729.csv
./market_rates/historical_rates/sirs@20060729.csv
./market_rates/historical_rates/sirs@20060702.csv
./market_rates/historical_rates/sirs@20060703.csv
./market_rates/historical_rates/sirs@20060704.csv
./market_rates/current_rates/data@20060707.csv
./market_rates/current_rates/sirs@20060707.csv
./market_rates/current_rates/data@20060729.csv
./market_rates/current_rates/sirs@20060729.csv
./market_rates/current_rates/sirs@20060702.csv
./market_rates/current_rates/sirs@20060703.csv
./market_rates/current_rates/sirs@20060704.csv

with delimiter "/", I wanna get the value of the last second field which is :
"sirs_extracts"
"historical_rates"
"current_rates"

Thanks guys
 
dont worry,

I sorted out.
awk 'BEGIN{FS="/"}{print $(NF-1)}'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top