On one line:
awk 'BEGIN { family = ""} { if ($1 == "@") family = $2; else print family, $1, $2 }' input.txt
Explanation
BEGIN {
family = "";
}
{
if ($1 == "@")
family = $2
else
print family, $1, $2
}
- Set family to empty string.
- Check each line: if starts with @, remember family name.
- If no @, print last remembered family name and first two fields.