Dharshana Eswaran 写道:
Hi All,
I am trying to extract strings from few files. The content of the file
reads
as shown
typedef struct
{
REFID_T pp_ref_id; /* destination */
CAUSE_T pp_cause; /* Reason registered */
STATE_T pp_state; /* State for indicators */
COMMON_TYPE_PLMN_T pp_plmn_list[COMMON_TYPE_MAX]; /*
list for the user */
TYPE_LAC_T pp_lac[COMMON_TYPE_MAX];
TYPE_T pp_cam;/* Cam for initiating only */
} NREG_IND;
I am extracting only the type and the variable names in different strings,
by using the command shown below:
......
.......
$xyz = <FILE>;
$xyz =~ /\s*(\w+)\s+(\w+);/;
How about replace the second \w+ to \S+? Just tested it simply and this
can work:
perl -nle 'print "$1\t\t$2" if /^\s*(\w+)\s+(\S+)\;/' t1.txt
--
http://home.arcor.de/jeffpang/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/