title: extract sub expression with sed
body: <p>I have a list of directories starting from /root. Eg </p>
  
  <p>random text /root/dir1/files random end</p>
  
  <p>delete me /root/dir1/files/2dir I am waste</p>
  
  <p>/root/examples/source alalalala </p>
  
  <p>/root/example/header some other text</p>
  
  <p>I want to use sed to take from every line the directory and remove everything else. My final output must be </p>
  
  <p>/root/dir1/files</p>
  
  <p>/root/dir1/files/2dir</p>
  
  <p>/root/examples/source</p>
  
  <p>/root/example/header</p>
  
  <p>How can I do it? (extract everything starting from /root... until the end of the path)</p>