[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extracting parts fof a string
From: |
Andreas Kusalananda Kähäri |
Subject: |
Re: Extracting parts fof a string |
Date: |
Wed, 10 Nov 2021 19:46:19 +0100 |
On Wed, Nov 10, 2021 at 06:24:18PM +0100, fatiparty--- via wrote:
>
> I have the following string "sel" composed of "Record: Name". I want to get
> "Name"
> on the right hand side of colon ":", removing the starting space.
>
>
>
Is the data in any common structured document format, like JSON or YAML?
If so, extracting data out of it with bash is probably not what you
want to do. You'd be better served by using a tool aware of that data
format, such as jq for JSON or yq for YAML. There are also command line
tools for parsing TOML, HCL, and other common formats. These tools
would not only be able to work with the document in an efficient and
safe way, but would also encode and deconde the data as needed.
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden
.