0

I have the following script that replace a param to b param and match only the c parameter in line how to change the perl syntax: if /$c/ in order to export c param to the follwoing perl syntax

#!/bin/bash
export a='@d&' 
export b='new text' 
export c='bla bla'
echo $LINE |  perl -pe 'next if /^#/; s/(^|\s)\Q$ENV{a}\E(\s|$)/$1$ENV{b}$2/ if /$c/' 

example of line

parameter=@d&

when c is the parameter

2
  • Put your code under code blocks. Commented Jun 15, 2010 at 6:49
  • yael, stackoverflow.com/editing-help Commented Jun 15, 2010 at 9:26

1 Answer 1

2

what you need is

if /$ENV{c}/

And please format your code properly

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.