Modifying the query to provide some more context.
I am writing a groovy script to get a list of objects output s3://xyz/1/abc s3://xyz/2/lmo s3://xyz/6/hjl
I need to grep the largest number in middle (here 6).
On command line I tried
echo "xyz/23/xyz/jhdids/dsd"|awk -F\/ '$0=$2'
awk: warning: escape sequence \/' treated as plain
/'
23;
It works on command prompt. But when I try to embed it in my groovy script, it gives error. In groovy - $4 has the value xyz/23/xyz/jhdids/dsd
aws s3 ls --recursive s3://xyz | sort | tail -n 1 | awk '{print $4|awk -F\/ '$0=$2'}\'
Hope this elaborates my issue. Thank you