Tip: Replacing Control Characters
Question: What is a control character? Why would I want to replace them? . . .
First, control character is a term for any non-printable symbol in an ASCII section of your text. Usually, they told a teletype to perform some sort of action. Which "transformed" into telling our ASCII printers to echo it. Then, the next generation became involved (after 1980) and now we have "outright anarchy." Anyhow.
• Why replace them? Here is why. Because, text files often get littered with them. Or you need to change LF/CR pairs to CR for Unix editing. (Although, usually I use unix2dos or dos2unix for the LF conversions.)
Steps:
- Move to where the control character is.
- Select it as a region
- Start the regex Search-Replace command
- Replace one occurence and then all the rest.
= Details
- Move there.
- Select Region: Ctrl-space, then cursor right
- Copy the region: Alt-y
- Start Regex Search-Replace: Alt-%
- = Yank back character: Ctrl-y, enter
- = Type replace character(s) or nada: **, enter
- = Hit "y" to replace once, "n" to skip one, then "!" to just replace the rest.
Platform: Linux
Level: Amateur
GlR


0 Comments:
Post a Comment
<< Home