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
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
3. Shell Programming and Scripting
Dear all,
I have a number of files and each file has two sections separated by a blank line. At the top section, I have lines which describes the values of the alphabetical characters,
# s #; 0.123
# p #; 12.3
# d #; -2.33
# f #; 5.68
<blank line>
sssssss
spfdffff
sdfffffff
Now I... (4 Replies)
Discussion started by: sasharma
4 Replies
4. Shell Programming and Scripting
I have got few date format patterns like "yyyymmdd", "yy_mm_dd" etc.
There can be any combination of such patterns.
I have used add_delta_days to find "yyyy", "yy", "mm", "dd" for the current date and saved them to different variables like "$y1", "$y2", "$m1" etc
In one line, i want to... (10 Replies)
Discussion started by: irudayaraj
10 Replies
5. Shell Programming and Scripting
Hi,
Can anyone help me to replace ='is NOT NULL' to is NOT NULL in perl.
I tried all the methods which i know, i didnt arrive at the solution.
please help!!
---------- Post updated at 03:01 PM ---------- Previous update was at 02:56 PM ----------
I got it.......!
Thanks, (1 Reply)
Discussion started by: jam_prasanna
1 Replies
6. Shell Programming and Scripting
Hi,
I am taking the current time using localtime function in perl. For example if the time is:
#Using localtime
$time = "12:3:10";
I have to replace the value 3 (03) i.e second position to be 03.
The output should be:
12:03:10
But if the other string for example:
$str:... (1 Reply)
Discussion started by: vanitham
1 Replies
7. Shell Programming and Scripting
find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g'
this is simple logic to find and replace in multiple files & folders
Hope this helps.
Thanks
Zaheer (0 Replies)
Discussion started by: Zaheer.mic
0 Replies
8. Shell Programming and Scripting
looking to replace parameters within a string with an external answer - with multiple replacements within a string %% will be used to wrap the objects to be replaced
i.e. hello %%title%% %%user%% from %%address%% you last %%action%% on %%object%%
the params will be used to make calls to a... (1 Reply)
Discussion started by: bidbrooken
1 Replies
9. Shell Programming and Scripting
I am very new to Perl. I am struggling so hard to search a date (such as 10/09/2009, 10-09-2009) from a text file and replace with a string (say DATE) using Perl. Please help me out. Thanks in advance.
Regds
Doren (4 Replies)
Discussion started by: my_Perl
4 Replies
10. Shell Programming and Scripting
I have written down a simple perl program to replace a string from a word file. My script does'nt seem to work. Any pointers to make it work will be appreciated. The code is given below.
#!/usr/bin/perl
while (<>) {
open(FILE,$_);
while (<FILE>) {
s/This/I did it/g;
}... (6 Replies)
Discussion started by: MobileUser
6 Replies