#delete blank lines, lines starting with numbers #delete headerline (Timestamp) #delete lines with null entries (7 tabs) /^%/{d} /^ *$/{d} /^\t[1-9]\+$/{d} /^[[:blank:]]Timestamp/{d} /^\t\{7\}/{d} #/^[[:alpha:]]\+/p #A normal line stars with a time stamp and has seven tabs with entries #in between #If line starts with alphabets or has only two or more tabs #then it is a part of fragmented line. They should be joined #to the previous normal line. /^\t[0-9/:]\+/{h;n} /^[[:alpha:]]\+/{H;n} /^\t\t\+/{H;n} g s/\n/ /g p s/.*//;x }