#!/usr/bin/perl -w use strict; while(){ chomp; next unless /^([^\|]+)/; print "$1\n"; } __DATA__ category1 category1|subcat1 category1|subcat1|subcat1 category1|subcat1|subcat2 category1|subcat1|subcat3 category1|subcat2 category1|subcat2|subcat1 category2 #### -- Joost downtime n. The period during which a system is error-free and immune from user input.