EDIT:
The goal here is to test if lines in fileB still exists in fileA and if not to delete them from fileB
1) fileA holds data that gets overwritten
2) fileB holds data from fileA to do calculations with and manipulate
3) Once fileA changes and particular lines in fileB are no longer in fileA because of the change then fileB must have those line removed aswell
I want to read a file line by line and check if that line still exists in a different file
fileA.txt has inputs of data like so but is over written every 2 seconds:
456 6554 56734657387365873456783456
457 4545 36747365467345735736345665
454 4357 98345783465785345567865535
456 6646 70899089089056879678575775
The content of fileA.txt is appended to fileB.txt
fileA.txt >> fileB.txt
I have fileB.txt that looks like this:
456 6554 56734657387365873456783456
457 4545 36747365467345735736345665
454 4357 98345783465785345567865535
456 6646 70899089089056879678575775
My MAIN GOAL is to read fileB.txt and check if each line still exists in fileA.txt and if not to remove that line from fileB.txt
Here is what I have started:
while read line
do
if grep -q "$line" fileA.txt; then
echo "This part is point less im still learning"
else
sed '/$line/d' ./fileB.txt
fi
EDIT:
The goal here is test is lines in fileB still exists in fileA and if not to delete them from fileB
1) fileA holds data that gets overwritten
2) fileB holds data from fileA to do calculations with and manipulate
3) Once fileA changes and lines in fileB that are no longer in fileA because of the change must also be removed from fileB done >fileB.txt