Grepping genus abundance table


I am running metaphlan 4 and generated merged the relative abundance tables. Now, I want to grep only “genus” abundance to make a heatmap. I used this to grep it.

grep -E "g__|clade" merged_abundance_table.txt | grep -v "s__" | sed 's/^.*s__//g' | cut -f1,3-8 | sed -e 's/clade_name/body_site/g' > merged_all_genus.txt

But this give a table like this:
k__Bacteria|p__Cyanobacteria|c__Cyanobacteria_unclassified|o__Synechococcales|f__Prochloraceae|g__Prochlorococcus 18.99867 14.05295 0.0 0.0 0.0

Shouldn’t I be getting only genus abundance? Like only genus name? Can someone help to point out any mistake in the above script?

Many thanks,

HI @mars
If you only want the genus name, you can include an additional cut like ... | cut -f6 -d "|" | ...