This question already has an answer here:
- Use a script parameter in awk 2 answers
I want to run the basename command on a certain awk field.
echo "1 /this/is/a/path" | awk '{print $1" "system("/usr/bin/basename " $2)}'
but the output always produces a 0 from the system command. How do I print the real output?
awk -F, '{printf "%s ",$1 ; system ("/usr/bin/basename " $2)}'
– Costas Feb 9 at 17:18awk '{gsub(/\/.*\//,"",$1); print}'
– DevNull Feb 9 at 17:20