Find & Replace within an Entire Directory or Git Repo with sed
If replacing within a directory:
grep -rl 'apples' /dir_to_search_under | xargs sed -i 's/apples/oranges/g'
Or, within an entire git
repository:
defmodule Run do | |
def in_parallel(n) do | |
1..n | |
|> Enum.map(fn(i) -> | |
Task.async(fn -> :timer.sleep(i * 1_000) end) | |
end) | |
|> Enum.map(&Task.await/1) | |
end | |
def serial(n) do |
# Sample usage: | |
# | |
# iex(1)> Calculator.calculate('123 + 27') | |
# 150 | |
# iex(2)> Calculator.calculate('123 - 27') | |
# 96 | |
# iex(3)> Calculator.calculate('123 * 27') | |
# 3321 | |
# iex(4)> Calculator.calculate('123 / 27') | |
# 4.555555555555555 |
If replacing within a directory:
grep -rl 'apples' /dir_to_search_under | xargs sed -i 's/apples/oranges/g'
Or, within an entire git
repository: