I am trying to use awk to get the name of a file given the absolute path to the file. For example, when given the input path /home/parent/child/filena
awk
/home/parent/child/filena
Another option is to use bash parameter substitution.
bash
$ foo="/home/parent/child/filename" $ echo ${foo##*/} filename $ foo="/home/parent/child/child2/filename" $ echo ${foo##*/} filename