EDIT: As OP mentioned in case any de
is empty with respective id
then print an hyphen, then try following.
awk '
BEGIN{
OFS="\t"
print "ID\t\tDE"
}
/ID/{
if(id){
print id,de?de:"-"
id=de=""
}
id=$2
next
}
/DE/{
$1=""
sub(/^ +/,"")
de=$0
}
END{
if(id){
print id,de?de:"-"
}
}' Input_file
Could you please try following.
awk '
BEGIN{
OFS="\t"
print "ID\t\tDE"
}
/ID/{
if(id){
print id,de
id=de=""
}
id=$2
next
}
/DE/{
$1=""
sub(/^ +/,"")
de=$0
}
END{
if(id){
print id,de
}
}' Input_file