When I start vi/vim as
ex, I can use the
-c option to provide the set of ex commands to apply to a file:
echo Yes | ex -sc 's/Y/y/|%p|q!' /dev/stdin yes
But how can I use normal mode commands like the
~ (switch case command) with
Based on a comment by @statox, I found a solution:
echo 'Élève' | ex -sc 'norm! g~w' -c '%p|q!' /dev/stdin éLÈVE
norm command allows executing Normal mode commands.
And I had to use two
-c option since, after
norm, the rest of the line is considered part of the normal-mode command to execute.