>> line="password requisite /lib/security/$ISA/pam_cracklib.so
>> newline="password required /lib/security/$ISA/pam_cracklib.so
>> I need to maintain whitespace
>>
>> perl -p -i -e s/"$line"/"$newline"/ file
>>
>> That tosses out all kinds of errors
>
> Modern regexp engines allow you to use an arbitrary char as the pattern
> delimiter. If I've got slashes in my patterns, I tend to use # as the
> delimiter, which allows you to avoid Leaning Toothpick Syndrome. Other people
> may use | . # is visually distinctive and not as common as / in some
> string-replace contexts, though:
>
> perl -p -i -e 's#"$line"#"$newline"#' file
The | sits right under the \ on the keyboard, so it is easy to put into
scripts. The # may seem like a reasonable delimiter unless the lines
being read in have comments in them. In which case most files I've seen
use the # to denote a comment or a comment line...
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss