Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I still find myself reaching for awk and cut for certain kinds of data analysis. So I added a new operation that's able to cover 80 % of their utility while staying in CyberChef.
Basically, it's a small DSL (similar to the awk print statement) for extracting fields from tabulated data like CSVs. It allows you to easily select the fields you want, reorder them, merge existing fields into new ones and so on. It also provides a nice pathway for carving CSVs from fixed width data, and for converting between different kinds of tabular data (e.g. CSV to TSV).
The following expression extracts the 0th field, joins the 1st and 2nd fields (with a "T" between them), extracts the 4th and 5th field, and then finally the last field.
0, 1"T"2, 4-5, -1
So far I've found it useful for stuff like:
Considerations
I'm not sure if 'Cut' is the best name for this operation, as it doesn't mirror the original UNIX behavior exactly and also incorporates concepts from awk. Perhaps Carve, Slice, or even Chisel might be good names.
The input/output record delimiters could be removed and replaced with Fork. I've included them because I suspect most users of the operation will want to apply it to several records at once, and to mirror how awk works.
Obviously nobody likes embedding new DSLs either, but being mostly based on the existing syntax offered by awk and cut, I would argue it's similar enough to them to be easy to pick up.