Advice on shell script to output only lines that do not exist in file

Advice on shell script to output only lines that do not exist in file

Post by samm » Sat, 09 Dec 2000 04:00:00



Appreciate advice on following:

INPUT_FILE
102
103
109

DATA_FILE

102
109
104
106

for i in `cat INPUT_FILE`
do
grep -v $i  DATA_FILE >>  FILE_WITH_NO_INPUT_FILE_NOS      # ie contains 104
and 106
done

Problem with script is that it loops for each input value 3 times and gives
an appended file of following:

109
104
106
102
109
104
106
102
104
106

Input file can have upto 800 values so I cant use egrep -v
'102|103|109|...' and run one time on data file data file can be up 1000
lines

Allso can't sort -u as from each loop of for    there would be an entry that
was not it would incude entries ie grep -v 102 would append 109 104 and 106

Thanks in advance

Sammy

 
 
 

1. Advice on shell script to output only lines that do not exist in file

Appreciate advice on following:

INPUT_FILE
102
103
109

DATA_FILE

102
109
104
106

for i in `cat INPUT_FILE`
do
grep -v $i  DATA_FILE >>  FILE_WITH_NO_INPUT_FILE_NOS      # ie contains 104
and 106
done

Problem with script is that it loops for each input value 3 times and gives
an appended file of following:

109
104
106
102
109
104
106
102
104
106

Input file can have upto 800 values so I cant use egrep -v
'102|103|109|...' and run one time on data file data file can be up 1000
lines

Allso can't sort -u as from each loop of for    there would be an entry that
was not it would incude entries ie grep -v 102 would append 109 104 and 106

Thanks in advance

Sammy

2. western digital auto sleep problem

3. Directing Shell Script output to a file from command line

4. Looking for source codes - lpr, lprm and lpq

5. Perl script log file output has duplicate copies of output lines

6. IndexOptions

7. unix shell script to access a file line by line

8. zImage zlilo, what's the difference?

9. Apache 1.3.9: File does not exist: path-to-existing-file

10. awk-outputting input line in specified output line

11. cron - shell script would not generate output in cron

12. Shell script acting as interactive shell - $0 not script name??

13. Need advice for modifying passwd file in shell script