Find and Edit Command in One
Have You Ever found a need to find a file for a particular pattern and then edit the same ?? Here is an easiest way.... At the UNIX prompt, Just type: vi `find . -name "*" -exec grep -l "pattern" {} \; -print` Where "pattern" is the string to be searched.
Renameing files with the find command I am attempting to rename files in a directory tree, using the find
command:
There might be better ways to do this. for i in `find your_dir -type f -name '*'`
I've tried this statement, however I still get the syntax error for the move command; when I replace the mv with echo $i; it writes out the find argument. e.g. with the move cmd:
Output is:
and the echo $i for i in 'find . -type f -name "file*" '
'find . -type f -name "file*"
Are you using single quotes, or backticks? ' or `
If you're using a shell like bash or ksh, you could do
it like this:
Dont use ' (single quote). Use ` (dont know what it is called but it
is left to the '1' key on the key board and above 'TAB')
Good stuff -that works fine. Yah I've had some problems using the ' and ` with commands in the past ....
Have a Unix Problem
Unix Books :-
Return to : - Unix System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|