extract url paths in bash code example Example: extract path from url sed $ grep -Po '\w\K/\w+[^?]+' <<<$url /one/more/dir/file.exe