Jump to content

shell scripting find/replace text


Recommended Posts

I have a project that a shell script is going to deploy on a server for me ni both a testing and a staging context. Some paths, db connection strings etc, will be different for my development environment and boththe staging and testing environments.

 

How can I, in a shell script (for bash) do a simple find and replace for text? Is it possible?

Link to comment
Share on other sites

Does sed do what you want?

Link to comment
Share on other sites

yes. and if you are like me who suck at regular expressions then having somebody handy to teach you (like aru for example if you can get his attention long enough :twisted:) the intricacies of RE+sed. not everything i scripted worked the way i planned them to but the simple expressions work well enough. :)

 

ciao!

Link to comment
Share on other sites

I may help you, but I don't have the time to explore all possibilities, so please post a specific example:

- Input data (env. number or name, ...)

- Rules (eg here at work, we have numbered envs, and we can access the logs like that: \\server\env_${ENV}\logs)

- Example of expected result.

 

Yves.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...