I have a script in which I have the following function:
function doOutput {
echo -ne "$(date +"${pre}%T ${1}")" | tee --append "${_logfile}"
}
My script generates messages with:
doOutput "${1}"
pre='\n' # Next output should be on a new line
But I also have notifications which should be overwritten by the next message and for this I use:
doOutput "${1}\r"
pre='' # Next output should be on the same line
Works OK. But in the logfile I get:
16:15:00 Nothing has changed^M16:30:00 Nothing has changed^M16:45:00 Nothing has changed^M
Is there a way to let Emacs display this like:
16:15:00 Nothing has changed^M
16:30:00 Nothing has changed^M
16:45:00 Nothing has changed^M
I do not mind if it will be like:
16:15:00 Nothing has changed
16:30:00 Nothing has changed
16:45:00 Nothing has changed
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
I have a script in which I have the following function:
function doOutput {
echo -ne "$(date +"${pre}%T ${1}")" | tee --append "${_logfile}"
}
My script generates messages with:
doOutput "${1}"
pre='\n' # Next output should be on a new line
But I also have notifications which should be overwritten by the next
message and for this I use:
doOutput "${1}\r"
pre='' # Next output should be on the same line
Works OK. But in the logfile I get:
16:15:00 Nothing has changed^M16:30:00 Nothing has changed^M16:45:00 Nothing has changed^M
Is there a way to let Emacs display this like:
16:15:00 Nothing has changed^M
16:30:00 Nothing has changed^M
16:45:00 Nothing has changed^M
I do not mind if it will be like:
16:15:00 Nothing has changed
16:30:00 Nothing has changed
16:45:00 Nothing has changed
2. And the stream editor, "/bin/sed", can produce the desired
output with:
$ cat -e datelog.txt | sed -e "s/\^M/\n\n/g"
16:15:00 Nothing has changed
16:30:00 Nothing has changed
16:45:00 Nothing has changed
$
3. This output can be directed to a new file, if desired:
$ cat -e datelog.txt | sed -e "s/\^M/\n\n/g" > newlog.txt
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 02:40:41 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
10 files (20,373K bytes) |
| Messages: | 264,324 |