19

How can I search and replace horizontal tabs in nano? I've been trying to use [\t] in regex mode, but this only matches every occurrence of the character t.

I've just been using sed 's/\t//g' file, which works fine, but I would still be interested in a nano solution.

Kusalananda
  • 333,661
nath
  • 5,694

2 Answers2

35

In nano to search and replace:

  1. Press Ctrl + \
  2. Enter your search string and hit return
  3. Enter your replacement string and hit return
  4. Press A to replace all instances

To replace tab characters you need to put nano in verbatim mode: Alt+Shift+V. Once in verbatim mode, you can type any character in it'll be be accepted literally when in verbatim mode, then hit return.

References

slm
  • 369,824
3

In case Ctrl+\ doesn't work as expected, one may use Alt+R as alternative.

αғsнιη
  • 41,407