Quote:
Quote:
My version also had a few bugs, though. My first grep should have had a -l parameter to list the files only, rather than show the matching lines. The syntax of my if statement is also incorrect. Sorry, I don't usually use this syntax :-) The square brackets (common syntax for the test built-in command) do not belong there. The corrected script (tested on AIX this time) is as follows: Code:
#!/usr/bin/ksh |
If you just want a list of the files that contain the pattern, then use the -l option:
Code:
grep -l <pattern> <files> Quote:
|
Quote:
|
Oh.. my bad I misunderstood that, here is a one liner then:
Code:
for i in `grep -R "zzz" * | cut -d ":" -f1`;do echo $i:; egrep "xxx" $i;done; |
Quote:
csh and ksh (including autoloaded functions). If you have experience with ksh you should find it quite comfortable. It is (in my entirely biased opinion) superior to bash both for scripting and interactive use. It has far too many features to go into (e.g. nested parameter expansion, csh-style paramter modifiers, floating point, associative arrays (hash tables), command line stack (push a half-completed command line, type another command (e.g. to check a man page etc), then the other line is popped back ready to be completed), some nice history handling options (e.g. remove duplicate history entries), dynamically loadable modules, programmable context-sensitive tab completion (it ships with completion functions for hundreds of commands), and that's just scratching the surface (the man pages (there are about a dozen) total about 4 or 5 times the size of bash's man page, which gives you some indication of the quantity of features (of course, some people read 'features' as 'bloat'!)). I certainly regard it as a step up from sh/bash in terms of expressiveness and functionality. Many (most?) Linux users just seem to accept bash as it is the default but it can be profitable to explore the other options. I bounced from bash to ksh to csh to tcsh before finally settling on zsh. There are also many other shells of course, like the scheme shell (scsh), but I do not have any experience with that (yet). Zsh may not be everyone's cup of tea but it's certainly worth taking a look at. Be warned though, it is very configurable and has many options (about 170 or so) and depending on one's preferences, may need a week or two to configure to one's liking. I've been using zsh more or less exclusively for over a decade and I'm still tweaking! edit: I'm still unclear on what output the OP wants, is it the matching content itself, or a list of the files that have matching content? |
what is means du -sg* commands
|
Aix commands pdf
|
All times are GMT -5. The time now is 05:10 PM. |