Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Can someone tell me what is wrong with this
#!/bin/ksh
set -x
grep
{ while read -r data
do
echo $data
grep -c Position $data > file
if [ -s file ]; then TABLES=Position
grep -c Participant $data > file
elif [ -s file ]; then TABLES=Participant
grep -c PosRelation $data > file
elif [-s file ]; then TABLES=PositionRelation
else print "ERROR in batch file incorrect data..\n"
#exit 1
fi
done } < batch_partpos.parmI am expecting it to look for each of the three names in the file and set the variable accordingly. However I get these error:
+ < batch_partpos.parm
+ read -r data
+ echo Position_02312007_123456
Position_02312007_123456
+ grep -c Position Position_02312007_123456
+ > file
grep: Position_02312007_123456: No such file or directory
+ [ -s file ]
+ [ -s file ]
+ [-s file ]
test[15]: [-s: not found
+ print ERROR in batch file incorrect data..\n
ERROR in batch file incorrect data..+ read -r data
+ echo Participant__02312007_123456
Participant__02312007_123456
+ grep -c Position Participant__02312007_123456
+ > file
grep: Participant__02312007_123456: No such file or directory
+ [ -s file ]
+ [ -s file ]
+ [-s file ]
test[15]: [-s: not found
+ print ERROR in batch file incorrect data..\n
ERROR in batch file incorrect data..+ read -r data
+ echo PosRelation_02312007_123456
PosRelation_02312007_123456
+ grep -c Position PosRelation_02312007_123456
+ > file
grep: PosRelation_02312007_123456: No such file or directory
+ [ -s file ]
+ [ -s file ]
+ [-s file ]
test[15]: [-s: not found
+ print ERROR in batch file incorrect data..\n
ERROR in batch file incorrect data..+ read -r data
+ echo Position_02312007_223456
Position_02312007_223456
+ grep -c Position Position_02312007_223456
+ > file
grep: Position_02312007_223456: No such file or directory
+ [ -s file ]
+ [ -s file ]
+ [-s file ]
test[15]: [-s: not found
+ print ERROR in batch file incorrect data..\n
ERROR in batch file incorrect data..+ read -r data
+ echo Participant__02312007_223456
Participant__02312007_223456
+ grep -c Position Participant__02312007_223456
+ > file
grep: Participant__02312007_223456: No such file or directory
+ [ -s file ]
+ [ -s file ]
+ [-s file ]
test[15]: [-s: not found
+ print ERROR in batch file incorrect data..\n
ERROR in batch file incorrect data..+ read -r data
+ echo PosRelation_02312007_223456
PosRelation_02312007_223456
+ grep -c Position PosRelation_02312007_223456
+ > file
grep: PosRelation_02312007_223456: No such file or directory
+ [ -s file ]
+ [ -s file ]
+ [-s file ]
test[15]: [-s: not found
+ print ERROR in batch file incorrect data..\n
ERROR in batch file incorrect data..+ read -r data

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |