I have 2 files:
- a file full of values I want to look for
- my source text file
I wrote a short shell command to loop thru my list of values and grep against my source file. If it doesn't find the value in the file, I want to print the value out.
The problem is it's printing every value so I'm not grepping the value correctly thus it always never matches and then prints the value because of that. Hopefully someone can tell me what I'm doing wrong. Thanks in advance.
Here's my script
for i in `cat uniq_val.out`
do
found=`grep "$i" fd.out`
if [ -z "${found}" ]
then
echo $i
fi
done
So for example, if my uniq_val.out contains this:
abc123
def456
ghi789
jkl101112
mno131415
And my fd.out contains this:
abc123
def456
mno131415
I want my shell script to return
ghi789
jkl101112
=
sign in the assignment offound
. – AdminBee Aug 07 '23 at 14:02fo*b
that would matchfoobar
; or are you looking for one-to-one matches between identical lines? – ilkkachu Aug 07 '23 at 19:36uniq_val.out
that don't appear infd.out
? – aviro Aug 08 '23 at 07:29