[slurm-users] Make sacct show short job state codes?

Brian Andrus toomuchit at gmail.com
Thu Mar 24 13:47:24 UTC 2022

I don't think that is part of sacct options. Feature request maybe.

Meanwhile, awk would be your friend here. Just post-process by piping 
the output to awk and doing the substitutions before printing the output.


     sacct  |awk '{sub("CANCELLED","CA");sub("RUNNING","RU");print}'

Just add a 'sub' command for each substitution. It is tedious to setup 
but will do the trick. You can also specify the specific field to do any 
substitution on.

Brian Andrus

On 3/24/2022 6:12 AM, Chip Seraphine wrote:
> I’m trying to shave a few columns off the output of some sacct output, and while it will happily accept the short codes (e.g. CA instead of CANCELLED) I can’t find a way to get it to report them.  Shaving down the columns using %N in –format just results in a truncated version of the long code, which is often not the same thing.
> Does anyone know if/how this can be done?
> --
> Chip Seraphine
> Linux Admin (Grid)
> E: cseraphine at drwholdings.com
> M: 773 412 2608
> This e-mail and any attachments may contain information that is confidential and proprietary and otherwise protected from disclosure. If you are not the intended recipient of this e-mail, do not read, duplicate or redistribute it by any means. Please immediately delete it and any attachments and notify the sender that you have received it by mistake. Unintended recipients are prohibited from taking action on the basis of information in this e-mail or any attachments. The DRW Companies make no representations that this e-mail or any attachments are free of computer viruses or other defects.

More information about the slurm-users mailing list