10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Trying to find and replace one string with another string in a file
#!/usr/bin/perl
$csd_table_path = "/file.ntab";
$find_str = '--bundle_type=021';
$repl_str = '--bundle_type=021 --target=/dev/disk1s2';
if( system("/usr/bin/perl -p -i -e 's/$find_str/$repl_str/' $csd_table_path")... (2 Replies)
Discussion started by: cillmor
2 Replies
2. Shell Programming and Scripting
Hi,
Can somebody tell whats wrong with "find and replace perl code".
I wanted to find "\n".write(status,data" and replace with "\n",data" in multipls files.
#!/usr/bin/perl
my @files = <*.c>;
foreach $fileName (@files) {
print "$fileName\n";
my $searchStr0 =... (4 Replies)
Discussion started by: chettyravi
4 Replies
3. UNIX for Dummies Questions & Answers
Hi!
I have a directory full of .plist type files from which I need to delete a line. Not every file contains the line, but of course I'd like to do it recursively. The line which I want to delete is:
<string>com.apple.PhotoBooth</string>
and looks like this in its native habitat:
... (9 Replies)
Discussion started by: sudon't
9 Replies
4. Shell Programming and Scripting
Can someone help me with a sed command:
There will be multiple occurences in a file that look like this:
MyFunction(12c34r5)
and I need to replace that with just the 12c34r5 for every occurrence. The text between the parentheses will be different on each occurrence, so I can't search for that.... (4 Replies)
Discussion started by: missb
4 Replies
5. Shell Programming and Scripting
Hello Folks,
#!/usr/bin/perl
use File::Find;
open F,shift or die $!;
my %ip=map/(\S+)\s+(\S+)/,<F>;
close F;
find sub{
if( -f ){
local @ARGV=($_);
local $^I="";
while( <> ){
!/#/ && s/(\w+)\.fs\.rich\.us/$ip{$1}/g;
print;
}
}... (8 Replies)
Discussion started by: richsark
8 Replies
6. Shell Programming and Scripting
Hi,
Please could someone advise, how I can resolve this issue with my find and replace command :
perl -i -npe "s#RLM_LICENSE.*#RLM_LICENSE=$TEAM_TOP/licenses/abc.demo.lic#;" environment.properties
$TEAM_TOP is an environment varible within my system.
when i run this perl command from... (1 Reply)
Discussion started by: fettie
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I tried to adapt bartus's solution to my problem, without success. I want to replace all the occurences of this:
with:
, where something can contain an arbitrary number of balanced parens and brakets.
Any ideas ?
Best, (1 Reply)
Discussion started by: ff1969ff1969
1 Replies
8. Shell Programming and Scripting
Hi Expert,
Could you please explain why below two perl code get different result?
Thanks a lot.
sub test{
return (2,3,4,5,6,3,4,50);
}
($a,$b)=(test); # 3,6
($a,$b)=test; # 2,3 (2 Replies)
Discussion started by: summer_cherry
2 Replies
9. Shell Programming and Scripting
Let's say I'm trying to match potentially multiple sets of parentheses. Is there a way in a regular expression to force a match of closing parentheses specifically in the number of the opening parentheses?
For example, if the string is "((foo bar))", I want to be able to say "match any number of... (7 Replies)
Discussion started by: cvp
7 Replies
10. Shell Programming and Scripting
Hi
I would like to replace a comma in parentheses to a semicolon for example. Other commas outside () stay unchanged. How can I do this?
aaaa,bbb,ccc,ddd(eee,fff,ggg),hhh,iii
to
aaaa,bbb,ccc,ddd(eee;fff;ggg),hhh,iii
Thanks (5 Replies)
Discussion started by: lalelle
5 Replies