I have a file that has a list of paths like so:
"1" "/user/bin/share"
"2" "/home/user/.local"
"3" "/root/"
Is there a way to extract just the paths? I dont want the numbers or quotation marks. How can I sed or grep the paths out of the file? What regex would be required for such a task?
Best Answer
If all the paths start with
/
, you could just match/
followed by a sequence of non-"
characters:Alternatively, for a more structured approach, use
awk
to strip quotes from and print just the second field: