Re: MergeLog.awk
- From: Gonzalo Paniagua Javier <gonzalo gnome-db org>
- To: Rodrigo Moya <rodrigo gnome-db org>
- Cc: GNOME Hackers <gnome-hackers gnome org>
- Subject: Re: MergeLog.awk
- Date: Fri, 18 Jan 2002 16:08:18 +0100
* [ Rodrigo Moya <rodrigo gnome-db org>
* Fri, 18 Jan 2002 15:40:54 +0100 ]
> I only find a little problem (from the output you sent me, since I can't
> get that out from the awk code :-), which is it prepends:
>
> ./directory/filename:
>
> to the filenames. Could you have it remove the ./ prefix?
Done!
Just changed one line.
BEGIN {
count = 1;
separator = "##%%##";
}
/^[12]/ {
dirname = FILENAME;
if (gsub ("/ChangeLog$", "/", dirname) == 0){
dirname = ""; # For executing in just one dir.
}
gsub ("^\\./", "", dirname);
idx_entry = $0 dirname ;
if (length(entry[idx_entry]) != 0){
# Somebody has to entries with same name, same date,... in the same
# directory.
old_content = entry[last_entry];
entry[last_entry] = old_content separator $0;
} else {
_index[count] = idx_entry;
last_entry = idx_entry;
entry[idx_entry] = $0;
dirs[idx_entry] = dirname;
count++;
}
}
! /^[12]/{
old_content = entry[last_entry];
entry[last_entry] = old_content separator $0;
}
END {
asort(_index);
for (i=count - 1; i>0; i--){
idx = _index[i];
final = split (entry[idx], lines, separator);
subst_str = "\t* " dirs[idx];
last_line_length = 0;
for (k=1; k <= final; k++) {
gsub ("^\t\\*( )+", subst_str, lines[k]);
print lines[k];
last_line_length = length (lines[k]);
}
# Add a blank line between entries that doesn't have one
if (last_line_length != 0) print "";
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]