how do I use the grep –include option for multiple file types?

You can use multiple –include flags. This works for me: grep -r –include=*.html –include=*.php –include=*.htm “pattern” /some/path/ However, you can do as Deruijter suggested. This works for me: grep -r –include=*.{html,php,htm} “pattern” /some/path/ Don’t forget that you can use find and xargs for this sort of thing too: find /some/path/ -name “*.htm*” -or -name “*.php” … Read more

How to print 5 consecutive lines after a pattern in file using awk [duplicate]

Another way to do it in AWK: awk ‘/PATTERN/ {for(i=1; i<=5; i++) {getline; print}}’ inputfile in sed: sed -n ‘/PATTERN/{n;p;n;p;n;p;n;p;n;p}’ inputfile in GNU sed: sed -n ‘/PATTERN/,+7p’ inputfile or sed -n ‘1{x;s/.*/####/;x};/PATTERN/{:a;n;p;x;s/.//;ta;q}’ inputfile The # characters represent a counter. Use one fewer than the number of lines you want to output.

Call a Unix Script from Excel Vba

One option would be to open the plink session in a WScript.Shell instead of executing it with a script file using VBA’s Shell. The plink program will run in interactive mode from the command line, and the WshExec object gives you direct access to the standard input and standard output streams of the process that … Read more

Awk replace a column with its hash value

So, you don’t really want to be doing this with awk. Any of the popular high-level scripting languages — Perl, Python, Ruby, etc. — would do this in a way that was simpler and more robust. Having said that, something like this will work. Given input like this: this is a test (E.g., a row … Read more

Exclude specific filename from shell globbing

if you are using bash #!/bin/bash shopt -s extglob ls !(fubar).log or without extglob shopt -u extglob for file in !(fubar).log do echo “$file” done or for file in *log do case “$file” in fubar* ) continue;; * ) echo “do your stuff with $file”;; esac done