back       next

In place variable substitution with AWK

The content of the input file becomes stdin for rm and awk. rm ignores the input and removes the file, but its file descriptor remains open until both commands, rm and awk is complete. AWK process this "nameless" file and creates a new file:

  { rm $CSV_FILE && awk -F',' -v stid="$ST_ID" '$1 ~ stid {gsub(/&/,"",$7)}1' > $CSV_FILE; } < $CSV_FILE

  • "-v" sets the awk variable that is passed in via shell script variable.
  • "gsub" replaces with "" all occurrence of & in the 7th field. Use "sub" for single/first occurrence substitution or GNU Awk's gensub for more articulated substitutions.
  • "1" is a shortcut which means print the current record:

pecl runkit with php-5.2.x

As of writing, the current pecl runkit-0.9 package does not compile with PHP 5.2+ . Below is how I got the latest installed from svn trunk on CentOS-5.4 with php-5.2.9.

  • Install runkit:
          svn co http://svn.php.net/repository/pecl/runkit/trunk/
          cd trunk
          phpize
          ./configure
          make
          make install

  • Create "/etc/php.d/runkit.ini":
          extension=runkit.so

  • Restart apache and validate with phpinfo.

Note: you would need php-pear and php-devel installed already.

y2k10 bug in SpamAssassin

If running 3.2.x version of SpamAssassin... (check with `spamassassin -V`) there is a y2k10 bug in the FH_DATE_PAST_20XX rule, causing all mails getting an extra 3.4 points:

Reference: SA Bugzilla – Bug 6269

The fix mentioned is to update the rules using `sa-update` and restart spamd. The rules in the update directory at /var/lib/spamasassin will get updated.

With the fix applied you should no longer see FH_DATE_PAST_20XX in the logs.

For a manual fix, update /usr/share/spamassassin/72_active.cf and change:

header   FH_DATE_PAST_20XX      Date =~ /20[1-9][0-9]/ [if-unset: 2006]

to:

header   FH_DATE_PAST_20XX      Date =~ /20[2-9][0-9]/ [if-unset: 2006]

Related reading on sa-update: SpamAssassin RuleUpdates

Syndicate content