This simple one liner does it:
find ./ -type f -exec sed -i -e 's/apple/orange/g' {} \;
from StackOverflow
This simple one liner does it:
find ./ -type f -exec sed -i -e 's/apple/orange/g' {} \;
from StackOverflow
According to this answer on StackOverflow: http://unix.stackexchange.com/questions/24954/when-is-xargs-needed/24979#24979 , you can easily parallelize tasks using xargs. To quote the given example:
$ find . -type f -name '*.wav' -print0 | xargs -0 -P 3 -n 1 flac -V8
This example will encode *.wav => *.flac, using three processes at once (-P 3
).
If you have configured Git to use sparse checkout to checkout a sub directory, but later decided that you don’t really need that sub directory, here’s what to do:
1. first delete the sub directory
2. open .git/info/sparse-checkout , delete the sub directory name in the list
3. git read-tree -mu HEAD
If you don’t do this, Git will stage the deletion of the sub directory for the next commit.
Some useful Git aliases
[user]
name = ...
email = ...
github = ...
[alias]
a = add
ap = add --patch
am = am -s
c = commit
cs = commit -s
ca = commit --amend
co = checkout
b = branch -vv
l = log --graph --all --abbrev-commit --date=relative --format=format:'%C(bold blue)%h%C(reset) %C(green)%ar %C(yellow)%an%C(bold yellow)%d%C(reset)%n %C(white)%s%n'
lt = log --graph --abbrev-commit --date=relative --format=format:'%C(bold blue)%h%C(reset) %C(green)%ar %C(yellow)%an%C(bold yellow)%d%C(reset)%n %C(white)%s%n'
ll = log --graph --abbrev-commit --date=relative --format=format:'%C(bold blue)%h%C(reset) %C(green)%ar %C(yellow)%an%C(bold yellow)%d%C(reset)%n %C(white)%s%n' -10 HEAD~6..HEAD
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit --date=relative
lf = log --pretty=fuller
ls = log --pretty=fuller --stat
s = status
d = diff
ds = diff --stat
dc = diff --cached
dcs = diff --cached --stat
dp = show
dhh = diff HEAD^!
dhhs = diff HEAD^! --stat
doh = diff origin/master HEAD
dohs = diff origin/master HEAD --stat
rb = rebase
rbi = rebase -i
rbio = rebase -i origin/master
t = tag -a
tl = tag -ln1
[core]
editor = vim
#[push]
# default = simple
[color]
ui = auto