I need to get top 20 records from database (Sybase) with a condition that all Char/varchar columns should have more than 4 characters.
I need to do this via shell scripting, I have got half logic (on how to get varchar/char columns and stored it in a file). But missing piece, is that how to pass those column names and check for the above said condition.
Do you have any sample pattern you can post, to look at the data.
For example if you are trying to extract top 20 records from (Char/varchar columns) say 5th field, that are more than 4 character long, you can use:
$ awk 'length($5)>4' file |head -n 20