Feb 11, 2003 #1 HIB049 Technical User Jan 31, 2003 19 GB Hello guys, Please can someone tell me how to do the following using awk? I am trying to get the filenames of the following /a/b/c/d.ksh /a/b/e.ksh /a/f/c/d/f/d/i.ksh /a.ksh Any help will be of great use Thks Ed
Hello guys, Please can someone tell me how to do the following using awk? I am trying to get the filenames of the following /a/b/c/d.ksh /a/b/e.ksh /a/f/c/d/f/d/i.ksh /a.ksh Any help will be of great use Thks Ed
Feb 11, 2003 1 #2 dickiebird Programmer Feb 14, 2002 758 GB You need to use NF (Number of fields) to find last field eg awk 'BEGIN{FS="/"} {print$(NF)}' list_of_files.txt HTH Dickie Bird (-))) Upvote 0 Downvote
You need to use NF (Number of fields) to find last field eg awk 'BEGIN{FS="/"} {print$(NF)}' list_of_files.txt HTH Dickie Bird (-)))
Feb 11, 2003 #3 marsd IS-IT--Management Apr 25, 2001 2,218 US Another one: awk '{ z = split($0,arr,"/" ; print arr[z] }' filename Upvote 0 Downvote