-1

I have a workflow where I copy the Mac path on the server and replace it with a Windows path. I'm using this bash function in my workflow:

    function nas () {
  echo -E $1 \
  | sed -e 's/^smb://g' \
  | sed -e 's/\//\\/g'
}

query=$1

nas $query

So I can convert this path:

smb://corp.atm.com/files/interdivisional/Graphics/11_DISPLAY/Neutral

to this:

\\corp.atm.com\files\interdivisional\Graphics\11_DISPLAY\Neutral

but I'd like to replace this part

\\corp.atm.com\files\interdivisional\Graphics\11_DISPLAY\Neutral

to this: I:\11_DISPLAY\Neutral

Any ideas?

Thank you!

Braiam
  • 1
  • 11
  • 47
  • 78
Jony
  • 1
  • 1
  • You don't need `sed` for this -- bash has built-in search-and-replace support. See [BashFAQ #100](https://mywiki.wooledge.org/BashFAQ/100), *How do I do string manipulations with bash?* – Charles Duffy Jul 25 '22 at 17:33

1 Answers1

-1
query='\\corp.atm.com\files\interdivisional\Graphics\11_DISPLAY\Neutral'
sed 's-\\\\corp.atm.com\\files\\interdivisional\\Graphics-I:-' <<<"$query"
KamilCuk
  • 120,984
  • 8
  • 59
  • 111