find . -name "*.xml" | xargs grep "iwantthis"
And I also tend to forget the vi keys. Small extract:
h - move left one character
j - move down one line
k - move up
l - move right
$ - go to the end of the current line
0 - go to the beginning of the current line
G - go to the last line in the file
15G - go to line 15
control-F - forward one page
control-B - backwards one page
n (N) - next (previous) in search mode (/ or ? forward or backward)
s/OLD/NEW/g - replace on current line
%s/OLD/NEW/g - replace every occurence in file (or use 0,$ instead of %)
x - delete one character
Update I have to add the standard replace in multiple files via sed command. Here is an example of how to move your eclipse workspace to another directory:
- find . -name "*.xml" | xargs sed -i "s,c:[/\\]java[/\\]eclipse,d:/eclipse302,gi"
I hear you. Here's my little script I put in my ~/bin dir:
ReplyDeletefile: findIn
#!/bin/bash
# usage findIn [file pattern] [search string]
find -name "$1"|xargs grep $2
were it not for shortcuts like that I'd go insane.
I always use:
ReplyDeletefind . -name *.html -exec grep -H {} \;
hehe, incase you are interested ;-)