Last column data using condition

Input:-A

A02 A02_1 5780 23780
A02 A02_1 5780 23780
A02 A02_1 5780 23780
A02 A02_1 134 2
A02 A02_1 134 0
A02 A02_1 134 1
A03 A03_1 5780 23080
A03 A03_1 5780 23080
A03 A03_1 5780 23080
A03 A03_1 34 2
A03 A03_1 34 0
A03 A03_1 34 1

Output:-B

A02 A02_1 134 2
A02 A02_1 134 0
A02 A02_1 134 1
A03 A03_1 34 2
A03 A03_1 34 0
A03 A03_1 34 1

I want data which have 0 or 1 or 2 in column 4

Also it is possible to cut data from that file A.

So File A:

A02 A02_1 5780 23780
A02 A02_1 5780 23780
A02 A02_1 5780 23780
A03 A03_1 5780 23080
A03 A03_1 5780 23080
A03 A03_1 5780 23080

Thanks

Try this:

#!/bin/ksh
> b
ex -s a <<-EOF
        g/ [012]\$/.w>>b
        g//d
        w a
        q
EOF

I use ksh, but this will also work with at least sh and bash as your shell.