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
If you're open to a Perl solution, here one similar to fedorqui's awk solution:
perl -F/ -lane 'print $F[-1]' input
-F/ specifies / as the field separator $F[-1] is the last element in the @F autosplit array
-F/
/
$F[-1]
@F