10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello Forum.
I have a file called abc.sed with the following commands;
s/1/one/g
s/2/two/g
...
I also have a second file called abc.dat and would like to substitute all occurrences of "1 with one", "2 with two", etc and create a new file called abc_new.dat
sed -f abc.sed abc.dat >... (10 Replies)
Discussion started by: pchang
10 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
Hi All,
I have a file in which contains location of various data files. I want to change locations using sed. Find and replace strings are in a separate file. Content of this file (/tmp/tt) -
/dd/pp/test/test/1/ /pp/aa/test/dg1/
/dd/pp/test/test/2/ /pp/aa/test/dg2/
/dd/pp/test/test/3/... (2 Replies)
Discussion started by: pandeyra
2 Replies
5. Shell Programming and Scripting
Hi,
I am stuck with an problem and want some help, what i want to do is
There is a directory name temp
which include file named t1.txt, t2,txt, t3.txt and so on.
These files contains data, but there are some bad character also that is % present in the files , I want to write the script... (13 Replies)
Discussion started by: parthmittal2007
13 Replies
6. 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
7. 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
8. Shell Programming and Scripting
Hi Experts,
I have a directory which have 500 ksh, they all have common path string.
I have replaced all the ksh in different directory so i need to change the path string.
Please help me how to search and replace it.
Thanks SKG (1 Reply)
Discussion started by: gauravsunil
1 Replies
9. UNIX for Dummies Questions & Answers
how to use sed command to find and replace a directory
i have a file.. which contains lot of paths ...
for eg.. file contains..
/usr/kk/rr/12345/1
/usr/kk/rr/12345/2
/usr/kk/rr/12345/3
/usr/kk/rr/12345/4
/usr/kk/rr/12345/5
/usr/kk/rr/12345/6
/usr/kk/rr/12345/7... (1 Reply)
Discussion started by: wip_vasikaran
1 Replies
10. Shell Programming and Scripting
I'm trying to use the following command to do a batch find and replace in all commonly named files through a file hierarchy
find . -name 'file' |xargs perl -pi -e 's/find/replace/g'
which works fine except for a substitution involving parenthesis.
As a specific example I'm trying to sub... (3 Replies)
Discussion started by: Jeffish
3 Replies