How to remove lines that exceed a certain charecter count?

I am trying to remove lines in a variable(nidlist) that exceed a certain charecter count(in this case 7).

I am trying to incorparate the function that removes the lines that exceed 7 into this piece of code

nidlist=$(print $nidlist |tr  ';'  '\n' | sort | uniq | tr '\n' ';')

Thank You

Get ideas from this example :

echo "abcdefghij;klmnop;qrstuv;wxyz" | tr ';' '\n' | sort | uniq | awk 'length()<8' | tr '\n' ';'

This will give you the length of the string...unless you have a concrete example, its hard to suggest..

echo ${#string}

Can do it in one awk:

nidlist=$(print $nidlist | awk '!x[$0]++&&length($0)<8'  ORS=\; RS=\;)

If it's an input file, one could use egrep I suppose:-

egrep -v "........" $file

The full-stop is a single character wild-card. There are eight of them to denote a line which matches any eight characters, so seven or less is not selected to be removed.

It's a bit of a convoluted thought process, but does that offer an alternative?

Robin