Print a specific length using awk

Hello, I have the following input data:

A C
AA GG
A G
CG AG

the code I tried:

awk -F" " '{ if ((length($1==1) && (length($2==1))) input_file

is not working, I need the output to be (such that only the columns containing one letter are printed)

A C
A G

Any help would be appreciated!

awk -F" " '{ if ((length($1==1) && (length($2==1))) input_file

was close, but has mismatched quotes, parentheses, and braces; misplaced parentheses; and does not specify an action to be performed if the condition in the if statement evaluates to true. This should work:

awk '{ if (length($1)==1 && length($2)==1) print}' input_file

or, more simply, (using the default action for a given condition):

awk 'length($1)==1 && length($2)==1' input_file

try also:

awk '!/[^ ][^ ]/ && /./' infile

If infile contains:

a 
 b

the above script will print both lines even though neither one meets the specified criteria. However, if the input never contains more than two fields and both fields always contain at least one character, it will do what is wanted.

The lines that contain only one letter columns are printed?

You're right. The specification is ambiguous as to whether lines containing any single character field are to be printed or only lines with the 1st two fields each being a single character are to be printed. The incomplete awk code provided seemed to be looking for fields 1 and 2 being single characters and allowing any number of other fields containing anything. But, the English description can be interpreted several ways including that just the single character values in the 1st two fields (not entire lines) should be printed whenever one or both of the 1st two fields are single characters. And, the sample input doesn't provide any guidance.

If one of us didn't guess correctly at the intent, Rabu will have to provide a better description of exactly what is wanted.