-->

DEVOPSZONES

  • Recent blogs

    How to remove first two period delimited value in bash?

     Data:

    OpenAI.Standard.code-cushman-fine-tune-002 OpenAI.Standard.gpt-35-turbo OpenAI.Standard.gpt-35-turbo-instruct OpenAI.Standard.gpt-35-turbo-16k OpenAI.Standard.gpt-4-finetune OpenAI.Standard.gptv OpenAI.Standard.ada

    Solutions:

    You can use the cut command in Bash to remove the first two period-delimited values.

    Terminal:

    echo "OpenAI.Standard.code-cushman-fine-tune-002" | cut -d'.' -f3-

    This command uses the -d'.' option to specify the delimiter as a period, and -f3- to select the fields starting from the third field (i.e., removing the first two period-delimited values).

    File:

    cut -d'.' -f3- data.txt

    Your data is in a file called data.txt

    Output:

    code-cushman-fine-tune-002

    gpt-35-turbo

    gpt-35-turbo-instruct

    gpt-35-turbo-16k

    gpt-4-finetune

    gptv

    ada


    No comments