what's wrong with this scripts?variable passing?# Programming - 葵花宝典
r*r
1 楼
I have a directory with hundreds of *.doc files,and I want to search a word "t
otal", if the total value is greater than 50, then I want to copy this file to
a new directory,and change the name sequentially to file001.doc,file002.doc .
...sth like that.
So, when I grep "total" ,I got
file1.doc
total: 12
file2.doc
total: 13
file3.doc
total: 56
...
#! /bin/tcsh
foreach wordfile (*.doc)
grep total $wordfile | awk '($2 > 50) {com = sprintf("cp " $wordfile "
../new_dir");print c
otal", if the total value is greater than 50, then I want to copy this file to
a new directory,and change the name sequentially to file001.doc,file002.doc .
...sth like that.
So, when I grep "total" ,I got
file1.doc
total: 12
file2.doc
total: 13
file3.doc
total: 56
...
#! /bin/tcsh
foreach wordfile (*.doc)
grep total $wordfile | awk '($2 > 50) {com = sprintf("cp " $wordfile "
../new_dir");print c