I’m trying to use awk to pull out particular substring in a file path. Given that I have something coming into the awk command as a/workspace/folder.fold/secondfolder/file.ext, how do I get it to result as folder.fold/secondfolder/file.ext?
I was trying to do
| awk -F "/" '{ print $2 }'
but that only gives me folder. Any help is certain appreciated, as I’m very new to awk.
Edit: It’s actually coming in as a/workspace/folder.fold/secondfolder/file.ext. The extra a/ gets pulled as $1 in my attempts.
awkis not the best tool for this, but you can do: