I have a LDIF file with structure that looks similar to:
NUMBER: 44567898787
ORGANISATION: Something
NAME: Joe
SURNAME: Johnny
PLACE: Somewhere
NUMBER: 44555444333
ORGANISATION: Unknown
NAME:Alice
SURNAME: State
PLACE: Here
I'm using AWK atm:
#!/usr/bin/awk -f
BEGIN{
FS = ":";
}
{
if($1 ~/^ORGANISATION/ ){ lm = $2 }
if( lm ~ /UNKNOWN/) if ( $1 ~ /^NAME/ )
print "NAME:" $2 " ORGANISATION: " lm;
}
END{}
In general what I want to achieve is to make it more interactive, so waiting for STDIN to enter the ATTRIBUTE like ORGANISATION, after that its VALUE like Unknown and print it or save to file. Working on file (as I mentioned) that have more than 10 Gigs. Any ideas?