Friday, July 31, 2009

I dont know how to extract the lines from a file using perl commands?

for example if there are hundred lines in a file.if the first pattern which is to be matched is in one line another pattern is in another line .how i have to extract those lines present in the file using PERL COMMANDS.


example program:


0000000 nul ack nul stx nul etx nul fs soh stx nulj nul stx


0000020 nul stx nul so nul ack nul j nul stx nul can nul s


0000040 nul ack nul dc2 stx ack o u t p u t File


0000060 . g d s nul dc4 etx enq %26gt; A ht F '


0000100 9 D 8 / sp esc Z T nul fs enq stx nul


0000120 nul can nul stx nul so nul ack nul j nul stx nul


0000140 nul so nul ack nul dle ack ack t ox c o n t _


0000160 C O N T nul eot bs nul nul ack cr stx nul


0000200 so stx nul y nul , dle etx nul nul nul nul nul


0000220 nul nul vt 8 nul nul nul nul nul nul vt 8 nul 0


i want to extract the lines in the line number 0000140 from ack ack to line number 0000160 (nul eot) .similarly thuout the file

I dont know how to extract the lines from a file using perl commands?
The easiest way to do this is to count back from the end of the array.





For instance, if an array has three values,


$item[0], $item[1] and $item[2] then you can access the last with:


$item[-1]... an easy way to reach it!

flower arrangement

No comments:

Post a Comment