Mailinglist Archive: opensuse (3135 mails)
| < Previous | Next > |
Re: [opensuse] filtering
- From: Vince Oliver <vince@xxxxxxxxxxxxxxx>
- Date: Sat, 10 Mar 2007 12:28:53 +0100 (CET)
- Message-id: <Pine.LNX.4.62.0703101225170.7868@xxxxxxxxxxxxxx>
On Sat, 10 Mar 2007, Anders Johansson wrote:
On Saturday 10 March 2007 08:39, Randall R Schulz wrote:
On Friday 09 March 2007 16:32, Anders Johansson wrote:
...
I'm not very happy with the string tests, but I couldn't find a bash
function that returned true on substring match. If anyone can think
of a cleaner way of doing it, I'd love to know it
Check out the [[ value = pattern ]] tests. There are options for both
glob and RE interpretation of "pattern."
Cool, that works, thanks
So
for dir in DH*; do
for file in `find $dir -type f -name more\*.dat`; do
[[ $file =~ t\(10\|9\) ]] || head -5 $file >> $dir/list;
done;
done
Thanks. But I do not want the whole content of files in 'list' just 6th, 7th columns and file names (as you mat read in awk command bellow)
for dir in DH* ; do
for file in `find $dir -type f -name "more*data.dat" -exec egrep -vq '\<t(9|10)\>' {} \; -print`; do
awk 'BEGIN{FS=","}{if(NR>1 && NR<7){ f=n=FILENAME;sub(/[^/]+$/,"list",f);sub(/.*\//,"",n);print $6,$7,n>>f}}' $file
done
done
this command works fine but filtering out lines with egrep does not work
----
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |