You can find each molecule in .gro file with coordination (x,y,z) for instance your CNT has a special coordinate that helps you to limit the number of water molecules in CNT. Usually, the number of water molecules are very much and you can not do this method manually. I use MATLAB with a loop (for and if) that analyzes coordinates of water molecules with special limits.
Berezhkovskii, Alexander, and Gerhard Hummer. "Single-file transport of water molecules through a carbon nanotube." Physical review letters 89, no. 6 (2002): 064503.
Yamamoto, Eiji, and Kenji Yasuoka. "Water molecules in a carbon nanotube under an applied electric field at various temperatures and pressures." Water 9, no. 7 (2017): 473.