已关闭。此问题需要details or clarity。当前不接受答案。
**想要改进此问题?**添加详细信息并通过editing this post阐明问题。
7小时前关闭。
Improve this question
我需要在下面的文本中插入一个新行。
cat命令使grep查找应该插入我想要的内容的行。
- "Experimentation":
- "Overview": experimentation/index.md
- "home AB":
- "Overview": experimentation/home-ab/index.md
- "Metrics": experimentation/home-ab/metricas/index.md
- "Adtional Metrics":
- "User Frequency": experimentation/home-ab/metricas/frequencia.md
- "MVT": experimentation/home-ab/metricas/mvt.md
- "INSERT": NEW_LINE_INCREMENT
- "home MAB":
- "Overview": experimentation/home-mab/index.md
- "Criação Standard MAB": experimentation/home-mab/criacao-experimento.md
这个文本是mkdocs.yml的一部分,对于每个管道,我需要增加一个链接。
我使用的命令是:
cat mkdocs.yml | grep -B 1 '"home MAB"' | sed 's/.md/\n - "b_metric": experimentation\/globo-ab\/metricas\/b_metric/'
我需要在块- "Adtional Metrics":
中增量插入新行并保存文件。
我希望每次运行脚本时都增加换行符,添加B和c_metric
- "Adtional Metrics":
- "User Frequency": experimentation/home-ab/metricas/frequencia.md
- "Page View": experimentation/home-ab/metricas/pageviews.md
- "Session Count": experimentation/home-ab/metricas/session_count.md
- "Click Followed by Play": experimentation/home-ab/metricas/click_followed_by_play.md
- "Video Watch": experimentation/home-ab/metricas/videos.md
- "MVT": experimentation/home-ab/metricas/mvt.md
- "INSERT": NEW_LINE_INCREMENT
- "b_metric": text_text_text.md
- "c_metric": text_text_text.md
1条答案
按热度按时间hl0ma9xz1#
例如,这是
mkdocs.yml
(我稍微修改了一下,使其更具可读性)。你可以用
yq
在Adtional Metrics
块中插入新行: