Re: search and replace to upper/lower case

Benno Schulenberg <[email protected]> Thu, 15 Oct 2020 16:15:05 +0200
Newsgroups gmane.editors.nano.general
Message-ID <[email protected]>
Hello Carlo,

Op 15-10-2020 om 15:07 schreef carlo:
> i can't get regex search and replace to change text case from lower to upper
> 
> \U and \L won't work with something like \U\1 in the replace-with string -- i
> may be failing the syntax

When you read 'info sed sed the', you will see than \L and \U are GNU sed
extensions.  Other tools (and nano) do not know these backslash escapes.

> i can do it by ^T and using sed as external command, but i have to enter the
> text string myself, like:
> 
> sed 's/^.*$/\U&/' <<< "uppercase me"

You can make a string bind in your .nanorc, for example:

  bind  Sh-M-U  "^T|sed 's/^.*$/\U&/'^M"  main

(where ^T and ^M are literal control characters, entered with M-V).

Restart nano, select the text you want to upcase, and hit Shift+Alt+U.

[Please answer to the list, not to me.]

Benno
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEv9AJBh5TUFKtDfIVDSjU0qCs6IQFAl+IWXEACgkQDSjU0qCs
6IR1rQ//ewVzvW9bY4lbTTRnIQs2/iTbJykBySnY4xyLfxR8yql+v/XoGL11TDko
O4FpDg0PiZ+cB1GyX5kqwgDqCxqwRogBVgOXAWlDx8iOBK25LbRRVTtylEOVsUKX
b7hl9DxU3Vw2B1UXWwZKeADi/C5HUhDbhZoT3qatDRkwVGaOZgledAX2SMcYAqrN
5T9XLeUtYOMUJUdMFpuzN+3Gmo3JNXut71TnM5zBo9hwydGMawHK76Nw4R7uX0K7
D1UYgCSJH7zZAAJQ6Cf/C7ghlY/eUGxMRQkYQ2dxwDobXDFqHFiDLwoP5PGz3Adc
C7eIKtRo9PesdHfWudnei/PX2IJob1XhkmUzZ5uoxnGmGAA8ttDWPWC12/OL3R8x
tpI6W0i/YyBJqiZx8LiB9wcjJ4sbZ3h/Mi9qSABb3BrttZQ2QVWy2/iBXA5+MOtG
wH+jF9PzJQ3Zcyll+NNhSHebK2xt4s51uh/FzCf6J32FAg3l9y0zs3mMZr+UqKvB
j7Swf0HbIWYXY+5oKuFmmMKWxcWzBi2Q+6OU7J28Wwwz2sGIKo8GfkXSar5P5qEE
p5X5zzAGIK2ImddsxKqq+A3jKmqdJ1VYfBg0clocVOo6ShcaWw/J19VA6EERDfjd
y4axWt/JwieMlIPnagzIHMc8BAxFU13G3dEJgerqdXfTJkqgaTQ=
=KsQ0
-----END PGP SIGNATURE-----