perl - Using one grep operation instead of two? -


is there efficient way use grep in following command running, since want use perl's grep?

@found = grep { !/$ip/ } `$ssh $ips[0] netstat -aan | /bin/grep 1010`; 

basically, connecting fileserver, executing netstat command , grep ip addresses containing 1010. on output need use grep find specific ip address. can done somehow using 1 perl command?

sure, can this:

@found = grep { /1010/ && !/$ip/ } `$ssh $ips[0] netstat -aan`; 

the condition use in grep can not arbitrary expression, full block of code if need be.


Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -