How to delete everything but a specific ligand from a PDB file using Linux-compatible free software?
What about a straightforward

grep -w " AAA " file.pdb &gt; ligand.pdb


? Where you substitute AAA with the name of the residue you want.