0

I need a way to replace an on-screen pattern with another string, regardless of what places that text on the screen. Maybe I can live without user input being replaced, but anything that comes from the stdout, stderr of any process - background or foreground, and even prompt strings need to be subject to replacement.

An example of one of the applications (though, this one doesn't affect the prompt, but I have other needs there):

I want to replace all series of digits w/ themselves, selectively underlined, so I turn 1234567890.1234567890 into 1̲2345̲6̲7̲890.1̲2̲3̲4567̲8̲9̲0. I've already aliased ls to do this, as well as a number of other commands that display long numbers, but I've come to like it so much that I want it global.

  • But... why? It does not make sense to replace output from a command. – Tommiie Jan 16 at 20:16
  • One reason is given in the original question: When you see n-digit numbers on screen, underlining triplets makes instantly clear what the order of magnitude is. Another, more subtle reason, is that I want something in my prompt that takes about a second to generate (I'm interfacing custom hardware) but I don't want to delay the prompt for the response. I'd like to print a prompt with a placeholder that is replaced when the data are available. I didn't put this in the original question because it's very much the Level 2 version. I have some other needs, too, but not worth getting into. – Sniggerfardimungus Jan 16 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.