Skip to content

Get the nth element after filtering #1542

Answered by aborruso
pluma9 asked this question in Q&A
Discussion options

You must be logged in to vote

A solution by verb could be this one:

mlr --csv cat -n -g color then filter '$color=="yellow" && $n==2' input.csv

In output you have

n,id,color
2,4,yellow

You can add cut -x -f n to remove n.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
2 replies
@aborruso
Comment options

@pluma9
Comment options

Answer selected by pluma9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants