[sed] Replace a tab character using sed

Doing some text manipulation with my glossaries lately. This little trick comes in quite handy for those who like to use Linux Terminals. The glossaries that I’ve created were done with OmegaT.

*NIX Tricks

Here’s how to replace all instances of TAB in a file input_file by, say comma (,), using sed

$ sed 's/<TAB>/,/g' input_file

But what is <TAB> above? On Linux systems you may just type t (which is the regular expression for TAB) in place of <TAB>. However,  on some other systems (e.g., OSX with FreeBSD) it does not work. In cases where it doesn’t work, invoke <TAB> by hitting Control+v followed by the TAB key. This may alternatively be achieved by hitting Control+v followd by Control+i, as well.

References:ATOzTOA, Stack Overflow.

View original post

Advertisements