hi plz help. Trying since 1 week.

acwl1 line we
james line rx
sijith fff xw
nisha nnn w
/sijith line r
/Arjun line w
vineeth line r
acls2 faculty x
arrr line2 w
Rahul line3 wx
Arjun line1 m
/Tom line wr
ac01l2 lineN w
aclM1 line1 rw
Ram line3 x
acalM line2 rx
acblM line3
/jaffer line m
Ram line3 x

Here the line starting with / is command and others is arguments.
if any commands last word matches any letters of arguments last word it have to
print that argument(have to print only the first matching).
if one command preceeds other command then it have to check the same argumnets list above
Here "Arjun line w" matches "sijith fff xw" so it have to output that argument(not nisha nnn w)

" /sijith line r " matches "james line rx"

we have to output james line rw

if any command preceeds argument then it have to continue upto next command and check
the matching arguments inbetween two commands
Here /Arjun is preceeds by argument "vineeth line r" so continue upto command "/Tom line wr" and
check argument between Arjun and Tom and prints arrr line2 w

Every time have to check arguments inbetween commands

Thank you so much for giving us an INSANE assignment...but We Are Not In A Mood To Do It ...!!!:angry:

plz help or give some advice...
i tried a lot to do

why dont you use strstr then use its return value to print that line ?

plz help or give some advice...
i tried a lot to do

Not that we can see. Did you read the post titled "Read Me: Read This Before Posting"