perl code

Hi

Please read the below information carefully and help me to solve the issue .

I want to know ,how to catch the word before perticular word using perl code??

Eg:

if the row contains

===========================

Original Order Tuple

Duplicatel Execution Tuple

=============================

see below code-

   /Value of field name ([^,]+),Original (\w+) Tuple/ and do {
     ($category, $type) = ($1, $2); 
 
 

in above code first it finds Original word and on the basis of Original it catches the Order and execution word in $type

insted of this i want to first catch Tuple and on the basis of Tuple word i want to figure out wheather it is is order or execution

How it is possible???

Thanks in advance

Your sample code does not correspond to your sample data.
The regex of your sample code will not match the sample data because the literal characters "Value of field name" are not present in your data.

Try something like this:

$
$
$ cat f14
Original Order Tuple
Duplicatel Execution Tuple
$
$
$ perl -lne 'print "The word right before \"Tuple\" is \"$1\"" if /.*\b(\w+) Tuple$/' f14
The word right before "Tuple" is "Order"
The word right before "Tuple" is "Execution"
$
$

tyler_durden