Computing.Net > Forums > Unix > grep: No such file or directory

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

grep: No such file or directory

Reply to Message Icon

Name: cadi56
Date: May 1, 2007 at 09:49:13 Pacific
OS: linux 2.4.21-40.ELsmp
CPU/Ram: i386
Comment:

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.parm

I 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




Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: grep: No such file or directory

prepend all CSV files in directory www.computing.net/answers/unix/prepend-all-csv-files-in-directory/8333.html

Check for new file, exec sql*plus www.computing.net/answers/unix/check-for-new-file-exec-sqlplus/6714.html

HELP removing directory/file HELP www.computing.net/answers/unix/help-removing-directoryfile-help/5622.html