There are many block indexers online that offer you the ability to enter an operation hash and get back all the relevant details, such as gas consumed and baker fee.
Check out TZKT: https://api.tzkt.io/
Injecting an operation returns an operation hash. There is no RPC API to fetch details based on an operation hash. The only way to do this with a "command" is to use the monitor API to check every block created, after your operation hits the mempool, to see if your operation is included. Then you can get all the details via the RPC for that block.
This will either require your application guaranteed to remain online until the block is published, or potentially having to scan a large number of blocks when you come back online. This is why people building applications rely on block indexers as they provide better solutions for these situations. You can find blocks and details by querying operation hash's at any point.
If you are designing a network that will run in sandboxed mode, and will have many such operations that you need to fetch, i'd consider deploying your own copy of an indexer in your network.
If you are using snadboxed mode, purely to do an experiment, why not move to the testnet, as then you will be able to use the testnet block indexer. Which will likely be how you would do it in "production" on the real network.
If this is a single, one off experiment, that is standalone from everything else, you could pipe the output from that command into a script and just try search for the text.