Skip to main content
deleted 3 characters in body
Source Link
pLumo
  • 23.2k
  • 2
  • 43
  • 70

If you cannot make the json valid, e.g. for an output of an API you have no control of, this will return your desired output:

perl -0777 -ne '/(dataset_key:\[[^\]]*\])/ && print "$1\n"' file.txt

Note: This would break if the contentitem contained a ].

If you cannot make the json valid, e.g. for an output of an API you have no control of, this will return your desired output:

perl -0777 -ne '/(dataset_key:\[[^\]]*\])/ && print "$1\n"' file.txt

Note: This would break if the content contained a ].

If you cannot make the json valid, e.g. for an output of an API you have no control of, this will return your desired output:

perl -0777 -ne '/(dataset_key:\[[^\]]*\])/ && print "$1\n"' file.txt

Note: This would break if the item contained a ].

Source Link
pLumo
  • 23.2k
  • 2
  • 43
  • 70

If you cannot make the json valid, e.g. for an output of an API you have no control of, this will return your desired output:

perl -0777 -ne '/(dataset_key:\[[^\]]*\])/ && print "$1\n"' file.txt

Note: This would break if the content contained a ].