I have a awk script which parses through a log file the script:
BEGIN{
print "ID", "vFiler", "Type", "host"
}
/=====/{
vFiler=$2
next
}
match($0,/root=[^,]*/){
n=split(substr($0,RSTART+5,RLENGTH-5),N,/:/)
for(i=1; i<=n; i++)print vFiler,$1,N[i];
}
Now my question, as you can see there is an ID set at the start, which should meant to be typed in every time before the script runs, since the files have different ID's every time. So I was wondering how I should do this, wether writing a shell script who does this and executes the awk script. Or is there a way to write this in the awk script (maybe with getLine?!)?
Output I want to achieve is:
ID,vFiler,Type,host
1,vfiler0,/vol/vol0,fapra8.net
4,vfiler1,/vol/lnxpjmmorena,fcvapd10.net
4,vfiler1,/vol/CSArchive,fcvapd11.net
(in the secound case the ID stays the same because the servers are listed on the same Type)
After executing the script, it should say something like "Type in the ID" or something like that.
If this can't be done within the awk script pls do not make the effort to write an shell script (in general I just want to know how I can do it, but im grateful for every answer)
Thanks in advance