如何将文件中的 bi-us-rds-September 文本值更改为 bi-us-rds- + 当前日期,以 9 月作为月份名称?

How do i change bi-us-rds-September text value in a file to bi-us-rds- + current date with september as month name?

我有一个包含几行代码的文件

标识符 = "bi-us-rds-15september"

我必须将“bi-us-rds-15september”更改为“bi-us-rds-current date & current month”。 例如 - “bi-us-rds-15september”和“bi-us-rds-18september”。 我想使用任务 shell 脚本来完成此操作,但我不擅长编写脚本。

只用日期格式

$ identifier="bi-us-rds-`date +%d%B`"
$ echo $identifier
bi-us-rds-18September

我建议使用 https://www.tutorialkart.com/bash-shell-scripting/bash-date-format-options-examples/

此外,您的问题有点无用 - 我建议下次至少提供您当前的脚本,以便我们可以更精确地提供帮助。

编辑:删除了多余的连字符,使其与您所需的确切输出相匹配

编辑:回复:您的评论...

$replace=Hi
$replacewith="Hey"
$ echo "Hi how are you?" | sed -e "s/$replace/$replacewith/g"
Hey how are you?