# Select a word and replace it with new one. CLI

**URL:** <https://discuss.kakoune.com/t/select-a-word-and-replace-it-with-new-one-cli/2077>\
**Category:** Recipes & Guides\
**Created:** [June 27, 2022, 10:37am UTC](https://discuss.kakoune.com/t/select-a-word-and-replace-it-with-new-one-cli/2077 "2022-06-27T10:37:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kvdm](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/k/7ba0ec/32.png) [@kvdm](https://discuss.kakoune.com/u/kvdm)\
**Post date:** [June 27, 2022, 10:37am UTC](https://discuss.kakoune.com/t/select-a-word-and-replace-it-with-new-one-cli/2077/1 "2022-06-27T10:37:54Z")

</div>

My goal is to replace a specific word on a known line in a config file with a new word from CLI. Now i open kakoune on that point and replace the word manually.

Pseudo command:  
`kak +100:20 ~/.config/cfg.yml select_a_word_statement 'new_word_string'`

I would be grateful if you point me to a way how to accomplish it.

---

<div class="post-metadata">

**Author:** ![tototest99](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/tototest99/32/629_2.png) [@tototest99](https://discuss.kakoune.com/u/tototest99)\
**Post date:** [June 27, 2022, 4:10pm UTC](https://discuss.kakoune.com/t/select-a-word-and-replace-it-with-new-one-cli/2077/2 "2022-06-27T16:10:31Z")

</div>

```auto
kak ~/.config/cfg.yml -f '100Xsfoo<ret>cbar'

```

to replace `foo` with `bar`.  
See `kak -h`.

If you want arguments you will have to create a wrapping CLI for this.

---

<div class="post-metadata">

**Author:** ![kvdm](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/k/7ba0ec/32.png) [@kvdm](https://discuss.kakoune.com/u/kvdm)\
**Post date:** [June 27, 2022, 4:33pm UTC](https://discuss.kakoune.com/t/select-a-word-and-replace-it-with-new-one-cli/2077/3 "2022-06-27T16:33:39Z")

</div>

This is what i need. Thank you for the example.
