I have a text file that contains a mix of different number of columns per line.
I want to only print the lines if columns 3, 4 and 5 of that line only contains number.
The trick is occasionally columns 3, 4 and 5 will have a special character "(", or ")" embedded in them, and I want to print these numbers too.
cat $filename | awk '{ if ( ($3 != "^[0-9]") && ($4 != "^[0-9]") && ($5 != "^[0-9]") ) print $2, $3, $4, $5 }' >>text.dat But it also prints such thing as: Au2, Cu2, etc.
Any suggestions?
UPDATE:
A relevant part of input text file looks like this:
Cu1 Cu 0.00000 0.094635(14) 0.094635(14) Cu2 Cu 0.00000 0.125943(15) 0.125943(15) . . . What I want is the following:
Cu 0.00000 0.094635 0.094635 Cu 0.00000 0.125943 0.125943 . . . Note that "Cu" is from the string in second column from the original input file, and I've gotten rid of the number and parentheses in columns 4 and 5. Note also that the parentheses could exist in column 3 as well. Numbers in the parentheses could be single digit.