http://www.perlmonks.org?node_id=1208870


in reply to Re: String searching in file
in thread String searching in file

Sorry but looking at your code more closely, I dont see how it will work, sorry if I didnt put all the details. $awsLists isn't populated, so my goal is to populate the file, then check if ip is there, and not do anything, but if it is there write to the file
@command=`aws ec2 describe-instances --filters "Name=instance-state-na +me,Values=running" | grep PrivateDnsName | cut -d ":" -f2| cut -d '" +' -f2 | sort -u `;
Result
ip-10-1-68-84.us-west-2.compute.internal ip-10-1-7-183.us-west-2.compute.internal ip-10-1-80-15.us-west-2.compute.internal ip-10-1-80-162.us-west-2.compute.internal ip-10-1-80-184.us-west-2.compute.internal ip-10-1-80-187.us-west-2.compute.internal ip-10-1-80-18.us-west-2.compute.internal ip-10-1-80-57.us-west-2.compute.internal