Yes, that's it, and there is indeed no output, as everything is put into files with extension ".txt".
Here's what it does:
Code:
sed -n '
| FOR EACH LOG LINE...
| Output "FILE <name of file>" if it is a file name
s/^.*creating lock file \(.*\)$/FILE \1/p
| If it was indeed so (t), then branch to label "file"
t file
| Else delete line and start at beginning with next
d
| From this label on, we know we've found a file name
: file
| Read next line
n
| Until we fine the closing of the block
/deleting lock file/ d
| Meanwhile output all not-found values: "= <value>"
s/^.*no identifier found for value = \(.*\)$/= \1/p
| And so on...
b file
| Now, all this output is worked on with awk:
' | awk '
| This function creates a new <name of file>.txt and reinit variables
function new() {
| Create file only if there is content
if (content != "" && out != "") { print content >out; close(out); }
| Then empty variables
out=$2 ".txt"
content=""
}
| FOR EACH LINE FROM SED...
| If it is a file name, call the function
$1=="FILE" { new(); }
| Else append the unfound value to the content
$1=="=" {
if (content != "") content=content ","
content=content "'"'"'" substr($0, 3) "'"'"'"
}
| At the end, we don't forget to create the last file
END { new(); }
'
The "'"'"'" you see above is
" begin awk string (enclosed between ")
' close awk script (enclosed between ')
" begin bash string (enclosed between ")
' this string's content is a single quote (the actual content of the awk string)
" close bash string (enclosed between ")
' reopen awk script (enclosed between ')
" close awk string (enclosed between ")
All that is so that we can put a single quote inside the awk script without having to enclose the script within double quotes instead of single quotes, which would force us to escape ("\" character) each and every ", \, or $ inside the script.
Yves.