-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!

1
  • You don't need sed for this -- bash has built-in search-and-replace support. See BashFAQ #100, How do I do string manipulations with bash? Commented Jul 25, 2022 at 17:33

1 Answer 1

-1
query='\\corp.atm.com\files\interdivisional\Graphics\11_DISPLAY\Neutral' sed 's-\\\\corp.atm.com\\files\\interdivisional\\Graphics-I:-' <<<"$query" 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.