Change multiple files

The following command is correctly changing the contents of 2 files. sed -i ‘s/abc/xyz/g’ xaa1 xab1 But what I need to do is to change several such files dynamically and I do not know the file names. I want to write a command that will read all the files from current directory starting with xa* … Read more

What are the differences between Perl, Python, AWK and sed? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

Environment variable substitution in sed

If I run these commands from a script: #my.sh PWD=bla sed ‘s/xxx/’$PWD”https://stackoverflow.com/” … $ ./my.sh xxx bla it is fine. But, if I run: #my.sh sed ‘s/xxx/’$PWD”https://stackoverflow.com/” … $ ./my.sh $ sed: -e expression #1, char 8: Unknown option to `s’ I read in tutorials that to substitute environment variables from shell you need to … Read more

Error when using ‘sed’ with ‘find’ command on OS X: “invalid command code .”

Being forced to use CVS for a current client and the address changed for the remote repo. The only way I can find to change the remote address in my local code is a recursive search and replace. However, with the sed command I’d expect to work: find ./ -type f -exec sed -i “s/192.168.20.1/new.domain.com/” … Read more