free hit counter

Wednesday, July 29, 2009

BLD_NUM via awk or perl

Trying to grab the build number out of my autogenerated file:

#define BLD_MAJOR 1
#define BLD_MINOR 5
#define BLD_STAMP 0
#define BLD_NUM 4541
#define BLD_STR ""
#define BLD_VAL 105004541L

awk is easy:

awk '/BLD_NUM/ {print $3}'

Perl runs outside of cygwin, so I went for this instead:

perl -lane 'if ($F[1]=~/BLD_NUM/){ print $F[2];}'

Labels: ,


Post a Comment

<< Home