![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ftp code in Perl | Raynon | Shell Programming and Scripting | 21 | 09-11-2008 03:44 AM |
| PERL Code | talashil | Shell Programming and Scripting | 2 | 06-06-2008 01:13 AM |
| Hiding perl-cgi code | sudhir_onweb | Shell Programming and Scripting | 4 | 03-21-2007 10:37 PM |
| perl code help | circleW | UNIX for Dummies Questions & Answers | 1 | 11-09-2004 05:28 PM |
| Perl: export variable to shell | oldtrash | Shell Programming and Scripting | 2 | 09-11-2003 10:23 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Refrence Shell variable in Perl code.
![]() I have 2 files a & b Contents of a are:- -------------------------- This is a Good Boy This is a Good Boy This is a Very Good Boy This is a Good Boy This is a Good Boy --------------------------- The contents of b are ------------------- This is Testing Beta -------------- I have a piece of code :- i=`cat a|grep "Very Good"` echo $i perl -pi -e 's/^(This is a Very Good Boy)/$1."\n".`cat b`/e' a Now the above piece of code works perfectly well. That is String 'This is Testing Beta', needs to be added just under the string ''This is a Very Good Boy', followed by the remaining lines of code from file a. However, I want to refrence Shell variable 'i' instead of hard coding the string 'This is a Very Good Boy'? Please help urgent. Any other forms of help are also welcome, I mean if we could do the above effort with just Shell,awk,sed or combination of all 3. All your help is highly appreciated. Regards Sri ![]() The Final Output Should look something like this. I mean the final contents of File a ---------------------- This is a Good Boy This is a Good Boy This is a Very Good Boy This is Testing Beta This is a Good Boy This is a Good Boy ------------------------- |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|