I am writing a shell script which is as below:
#!/bin/bash
try="7200005781
8110892533
9585055818
9942609990
9943985228"
filename="TAMILNADU,917373342777,POSTPAID
TAMILNADU,917639403547,POSTPAID
TAMILNADU,917639989185,POSTPAID
TAMILNADU,917667882223,POSTPAID
TAMILNADU,918012888899,POSTPAID
TAMILNADU,918098909992,POSTPAID
TAMILNADU,917200005781,POSTPAID
TAMILNADU,918110892533,POSTPAID
TAMILNADU,919585055818,POSTPAID
TAMILNADU,919942609990,POSTPAID
TAMILNADU,919944040565,POSTPAID
TAMILNADU,919943985228,POSTPAID"
#echo -e "\n${try[@]}" -> works
#echo -e "\n" -> works
#echo -e "\n${filename[@]}" -> works
for j in "${try[@]}"
do
for k in "${filename[@]}"
do
sed -i 's/$j//g' $k > master.txt
done
done
I am trying to match 'try' and 'filename'
If any number of matches from 'try' in 'filename'
I need to remove that entry from 'filename'
Kindly help me with this.