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