1

I used the following command to find google in 1.txt and paste it once, but it didn't work. I guess it's because p in vim is not a command using after :. But how can I fix this problem?

vim "+g/google/y a" -c "p" -c "wq" 1.txt 
1
  • Why on earth are you using vim for this, and not i.e. sed or grep? Commented Feb 15, 2022 at 8:48

1 Answer 1

2

Ex-command for pasting is :put:

-c put 

(no need to quote, there is nothing to protect from shell.)

You can also use :normal:

-c "normal p" 

(quotes are used to protect the space.)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.