Can't grep pathnames out of string
I have a string:
Code:
tmp=Only in /home/a/.config/cairo-dock/third-party/Clear/icons: pcmanfm.svg Only in /home/a/.config/cairo-dock/third-party/Clear/icons: system-file-manager.svg Only in /home/a/.config/cairo-dock/third-party/Clear/icons: thunar.svg Only in /home/a/.config/cairo-dock/third-party/Clear/icons: thunderbird.svg Only in /home/a/.config/cairo-dock/third-party/Clear/icons: utilities-system-monitor.svg Only in /home/a/.config/cairo-dock/third-party/Clear/icons: utilities-terminal.svg
I would like to extract anything that is a path. "grep" comes to mind and I utilize the pattern that any 'path' will start with a "/". My attempts below:
Code:
$ echo $tmp | grep /
$ echo $tmp | grep ^/
$ echo $tmp | grep -w ^/
$ echo $tmp | grep -w /
$ echo $tmp | grep -w "/"
$ echo $tmp | grep -w '\</'
$ echo $tmp | grep -w '\:\>'
$ echo $tmp | grep -w ':\>'
$ echo $tmp | grep -w '\</*:\>'
$ echo $tmp | grep '\</*:\>'
Results
{fail}
Unfortunately the above attempts yeild no results. It was interesting that when I tried
Code:
$ echo $tmp | grep /
it printed out the entire string, which is why I used -w quite often.
Lastly I wondered how the above commands could be printing out to standard error, so I tried:
Code:
$ echo $tmp 2>&1 | grep /
$ echo $tmp | grep / 2>&1
$ echo $tmp | grep -w / 2>&1
Alas, still I couldn't extract the path.
Can the paths in the above string be extracted? Should I use a 'for in 'echo list'; do * ; done' loop?