Automating atom group selection in gromacs

i am trying to make some automated analysis script on gromac but run is getting stuck during atom group selection steps. for example gmx make_ndx -f protein.gro -o protein.ndx
groups GROMACS creates:

0 System : 33624 atoms
1 Other : 33624 atoms
2 water
3 Protein
… is there any way to add autoselection in trjconv or trjcat steps. e.g. select 1 for centering , select 0 for output.

echo N | gmx trjconv ... where N is the group number you want. You can also use echo "Protein" | gmx trjconv ... etc.

An example of auto selection is as follows

echo 1 0 | gmx trjconv -s em.tpr -f prod.xtc -o prod.mol.xtc -pbc mol -center

Here, we used 1 for centring and 0 as output. You don’t need to create a new index file

echo c c c c c | gmx trjcat -f 7_1.xtc 7_2.xtc 7_3.xtc 7_4.xtc 7_5.xtc -o output.xtc -tu ns -settime

sir i cant use echo for trjcat command

This is different problem. Trajcat is different command. Trjcat is for combining trajectories. See this link