How to copy lines that starts with either 3 or 4 into new file?

Hi Guys,

I have an awk script that would search the input file for line that starts with a number 3 and copies into a new text file.

I want to extend this script to find the lines that either starts with 3 or a or b and copy all those lines into the new file.

Here is what I have so far:

awk '/3/,0' source.txt > target.txt

Can someone please help me with extending this to find lines that start with more than just one character/number?

Just to be more detailed here is how the input file would look like:

3ajdlkfja
4jdlkajfdlajf
jdlkfjalda
phdlkfajlkdj

I want to print lines that start with either 3 or 4 or p. so in the new file, line number 1,2 and 4 should get copied.

Many Thanks.

Why awk? Try grep:

egrep "^3|4|p" inputfile > newfile