October 19th, 2009, 04:33 AM
File parsing script, showing progress
I have a korn-script running on an OpenBSD 4.5 box, what it does is quite simple, it just scans a file line by line for some characters that shouldn't be there, and if they are anyways, it sends an alert.
Now on occasion this might need to be run manually by some less then technically gifted people, so I'd like some way to show the progress of it.
Nothing fancy, I was just thinking about something like printing what line it's currently processing or some such, maybe something like:
Total lines: 103741
Processing line: xxxx
I already have a variable for keeping track of the current line, however for the life of me, I just can't figure out how to nicely update the visual line count without resorting to stuff such as doing a clear of the screen for every line, which basically just turns it into a blur since the script plows through something like 10K lines per second.
I was thinking about using "echo -ne" for this, along with backspace characters, however I'm a bit certain about how to do this exactly.