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