shell 脚本只替换变量中的第一个字符串

San*_*ngh 0 bash shell-script

我有一个变量${value},它的内容是:

bigint_col, smallint_col,string_col,string_col,string_col, bigint_col, string_col,string_col,timestamp_col,timestamp_col,timestamp_col,timestamp_col
Run Code Online (Sandbox Code Playgroud)

我只想先bigint_colmy_col变量本身替换,以便新内容看起来像这样

my_col, smallint_col,string_col,string_col,string_col, bigint_col, string_col,string_col,timestamp_col,timestamp_col,timestamp_col,timestamp_col
Run Code Online (Sandbox Code Playgroud)

我正在寻找一些帮助来解决这个问题。

Dop*_*oti 5

echo "${value/bigint_col/my_col}"  # outputs contents of $value replacing the first instance of 'bigint_col' with 'my_col'
Run Code Online (Sandbox Code Playgroud)