0

I want to extract the second folder in a path. The first folder view/ is constant

view/v_os_xxx/my/folder/abc.js
view/v_os_burger/some/other/folder/xyzdf.js

I've read several SO & SuperUser questions though this answer seems to get me close but just cannot seem to eliminate the folders to the right of my target.

Here is what I have thus far: sed -E "s/^view\/(v_os_.*)\/.*$/\1/" which gets me to /v_os_xxx/from/my. I just don't know how to tell sed to stop matching in the group after it encounters the first trailing /

Todd
  • 652
  • 2
  • 19
  • 37

0 Answers0