LoginSignup
16
5

More than 5 years have passed since last update.

jqで文字列のlike検索をする

Last updated at Posted at 2017-01-19

sample data

wine.jl
{
  "color": "red",
  "name": "Pinot Meunier"
}
{
  "color": "red",
  "name": "Pinot Noir"
}
{
  "color": "red",
  "name": "Merlot"
}
{
  "color": "white",
  "name": "Pinot Gris"
}

nameがPinotで始まるハッシュだけ表示する

$ cat wine.jl | jq '.[] | select(.name | startswith("Pinot"))'

{
  "color": "red",
  "name": "Pinot Meunier"
}
{
  "color": "red",
  "name": "Pinot Noir"
}
{
  "color": "white",
  "name": "Pinot Gris"
}
16
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
5