I have this command from the question Can automation service to get the parent folder path? but it has spaces in it.
When it's ran it looks like this:
File Path: file:///Volumes/Desktop/Fortigate/Fortigate 200D/Policies.txt
Parent Folder: file:///Volumes/Desktop/Fortigate/Fortigate 200D
This is exactly what I wanted except that it has spaces and it needs to have %20 instead of the spaces in the file path.
Could someone show me how I would edit the shell script below to replace these spaces with %20?
toTheClipboard="File Path: file://$1 Parent Folder: file://$(dirname "$1")" pbcopy<<<"$toTheClipboard"
Best Answer
You can pipe to
sed 's/ /%20/g'
to replace spaces with %20.