script for deleting matched line of a file from another file
hi everybody
i have two text file named 1.txt & 2.txt 1.txt contains 5 laks of mobile number. 2.txt has 60 laks of mob no. situation is that i want to find and delete numbers in 2.txt which already in 1.txt so can any body provide me any perl or bash script or any other way to get the work done i tried the following ---------------------- #! /bin/bash IFS=$'\n' for NAME in $(cat one.txt) do sed -ie "\|^$NAME\$|d" two.txt done echo "***DONE***" ---------------------- it works well with smaller file but it take very very long time even processing 10 thousand numbers. plz ur support urgently required. thanks |
Hi,
Welcome to LQ! Now that we are all aware of your 'needs'. What are your 'deeds'? Seriously it would be easier if you provide us with what you have attempted to solve your task? Then we can aid you. Especially if this is homework then aid is what we should give you since you would be the one getting grades on the project. :) |
A method using grep:
Code:
grep -v -f 1.txt 2.txt > 3.txt |
All times are GMT -5. The time now is 10:38 AM. |