Hi!
Quick q:
I want to filter out only the location from a file path. I.e. getting only the string /root/ from
the string /root/file.db .
I do this using regexp, no problem. So if I have the file path text string in a file I'm getting what I want using:
Code:
egrep '^(.*[\\\/])' /path/to/file
which returns
/root/file.db with /root/ in red color.
But how the h**l do I extract that into a variable? If I use awk with the same regexp it prints the whole line.
And
Code:
var=$(egrep '^(.*[\\\/])' /path/to/file)
also stores the whole line into var.
Regards,
Pelle