I'm only any good with php, but here's my two cents anyway. write a script to read the file, search (think ereg() or egrep_replace()) for \n characters, then stript them. Include a few lines to remove '-''s and entire lines containing 'logNo : '.
Your requirement is a little vague. Are you showing the output for your entire sample input? If so, how do you know which entries to skip?
Perl is a fine tool for such programs, as are awk, ruby, ... But understanding your problem adequately is one key to getting a solution. (I'm prejudiced: I would never recommend a shell for a job like this.)
Stuff like this reminds me why I don't use csh. Here's an awk solution. On Solaris, you have to use /usr/xpg4/bin/awk; FreeBSD 4.8 uses nawk (and perhaps awk, but on 4.8 awk is gawk, though that's changing in 5.x ...)
#!/usr/xpg4/bin/awk -f
$1 ~ /^[0-9]{4}(-[0-9]{2}){2}$/ {
# If the first field looks like
# a date, use it and the second field
date = $1
time = substr($2, 1, 8)
}
index($0, eventname) {
# Found the event name, so spit out the
# name with the previously gathered date
# and time
split($0, a, ";")
print date ";" time ";" a[1]
}
Put this in a file (call it "scanlog", perhaps) and mark it executable. Then invoke it like this:
scanlog -v event=oltprogramm <losed >layer
The entire thing operates in a single pass over the file with a single process. Your solution creates 4 * n + 1 processes, where "n" is the number of events that matches your input pattern.