Home: Perl Programming Help: Beginner:
Get value in single quote

New User

Jan 17, 2013, 4:47 AM

Views: 2191
Get value in single quote

I am trying to create a script in linux but facing some problem.

In single quote, i cannot get any value from outside as per rule.

Suppose my raw data is

134 PTR server1.example.com.
135 PTR server2.example.com.

and i want to change it to PTR server1.example.com. PTR server2.example.com.

below value get always change


so i have set one variable i.e.


if i use this command then it is not taking value. Can we achieve this with perl ?

cat file.txt | awk '{print $1".$VALUE.in-addr.arpa.", $2, $3}'

so please suggest

Veteran / Moderator

Jan 17, 2013, 5:06 AM

Views: 2188
Re: [askforunix] Get value in single quote

What about using double quotes?

Something like: $value = "0.168.192";

Veteran / Moderator

Jan 17, 2013, 8:23 AM

Views: 2184
Re: [askforunix] Get value in single quote

perl -pe 's/^(\d+)/$' file.txt

(This post was edited by FishMonger on Jan 17, 2013, 8:24 AM)