On 15/03/07, Ryan Simpkins <centos at ryansimpkins.com> wrote: > less file; *Right data, I see the patterns* > grep pattern file | less; *mistake* > grep pattern2 file | less; *right, time to reduce* > grep pattern2+pattern3 file | less; *Yes, that is right* > > What I don't like about the alternate method is where the file name lives in the > first two lines between the comparison. Also, the pattern is before the file on the > first grep, making it harder to adjust the pattern (which some of us need to do > quite a lot). It makes more sense to me to just add a | on the end and keep going. > Further, for me, it is easier to reduce data by stringing greps together rather than > come up with the regex-fu to do it all in one pattern. Maybe if I were better at > regex... Do you use bash command line shortcuts? I have CTRL-A, CTRL-E, META-F [1], META-B and META-D ingrained in my fingers which eases the pain of things not being *quite* where you want them. CTRL-A - jump to beginning of line (like HOME if your terminal's setup right) CTRL-E - jump to end of line (like END if your terminal's setup right) META-F - forward one word at a time, like 'w' in Vi. META-B - backward one word at a time, like 'b' in Vi. META-D - delete one word, like 'dw' in Vi. There are more but learning those couple be heart really helps me, even on misconfigured terminals[2]. For example, to change the 'file' element in... $ something /path/to/file | alskhflkasdflasjdfljk | lajkdhflakjsdflkasjd | alsdjkhflasdjkhf CTRL-A ALT-F ALT-F ALT-D start typing replacement filename. Which is much easier that it looks when actually typed out. :) Will. [1] Typically ALT [2] Other people's obviously :)