Regular Expression for line

Hi,

I'm trying to extract if the (offset>0 || flags [MF] ) from the following line:

90.30.180.90.80 > 90.121.333.308.45133: Flags [.], seq 14480:15928, ack 1, win 8088, options [nop,nop,TS[|tcp]>
15:59:11.156664 IP (tos 0x0, ttl 20, id 44442, offset 0, flags [DF], proto TCP (6), length 1500)

try:

offset.([0-9]+) || flags.(.("MF"))

not getting result. Any suggestions

What are you doing? Are you asking for help with grep, some programming language, or a third alternative I can't imagine yet?

trying to get help with the regular expression writing ..

Yes. Regular expression in what? grep? egrep? perl? sed? awk? They're not all the same.

TCL

But I don't mind the help in awk

See if this is working for you

awk '{match($0,/offset [0-9]+, flags .[A-Z][A-Z]./); print substr($0,RSTART,RLENGTH) } '

I tried it but I'm still getting syntax error.

I'm trying to run the script over a file and I'm using the following syntax:

awk -f filename '{match($0,/offset [0-9]+, flags .[A-Z][A-Z]./); print substr($0,RSTART,RLENGTH) } '

Any suggestion!!!

-f is when using awk program in seperate file.
FILENAME goes after the statement

awk 'code' filename 

or

awk -f awkprogram filename

Please read manual pages.

Regards
Peasant.