On Saturday 10 March 2007 12:28, Vince Oliver wrote:
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 '\
' {} \; -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
No. It wouldn't take much to add my test to your awk, but I still think awk is the wrong tool to use for something so light for dir in DH*; do for file in `find $dir -type f -name more\*.dat`; do [[ $file =~ t\(10\|9\) ]] || for i in 1 2 3 4 5; do IFS=' ' read -a line; echo ${line[5]} ${line[6]} $(basename $file) >> $dir/list; done < $file; done; done There are very few things you can't do with bash alone. I just wish I could think of a way to eliminate the 'find'. That one really annoys me -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org