in reply to file line editor one-liner

because the match operator, m//, uses matching delimiters, //, which need escaping, pretty much like you need to escape single quotes in 'single quoted strings', and double quotes in "double quoted strings"

You can use balanced delimiters like m{} , and for substitution operator s{}{}

Replies are listed 'Best First'.
Re^2: file line editor one-liner
by repcsi (Initiate) on Feb 10, 2012 at 11:38 UTC
    Thank you, now it works! I had to escape $src_running with a backslash, because it was handled as a variable, but now it works! :) Working code:
    /usr/bin/perl -ni -e 'if ( $_ =~ m{^#start /usr/sbin/xntpd} ) { print +"start /usr/sbin/xntpd \"\$src_running\" \"-x\"\n" } else {print}' /e +tc/rc.tcpip