May 26, 2015, 6:27 AM
Post #6 of 7
The short answer is "no".
Re: [varunparihar] Replacing 'ABC' string with 'abc:@192.1681.1.'
[In reply to]
Your new command is command to your operating system to run perl with three options. The -p tells perl to loop through the standard input, process each record with the code in -e'...', and print the result. The -i specifies that the changes are to be made to the original file. You have not specified an input file. Perl will use your operating system default (almost certainly your keyboard). Your code inside the -e option is a perl substitution command using two scalar variables. You have told me what they should contain, but you have not told perl. They are both global variables with the value undef. The -p option will never pass in an undefined string, so the substitute command will never make a match. With no match, it does not do anything. If you try to run your command, it will appear to "hang" because it is waiting for input from your keyboard.
The -p and -i options are seldom a good idea when you need to read more than one file. By default, perl concatenates them, which is not what you want.
The code that you need to process one line would look like the code in my previous post, except that you would open disk files instead of memory files. (Refer perldoc -f open). If you wish to loop through the second file and/or save the results to another file, you must add the code to do that.