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
Hi,
I have string like this:
$query="#1,apple";
$string=$query;
I want to replace #1 with fruit. I tried like this:
string=~s/#\d+/$query/ig;
print "\n string: $string\n";
It is working only when there is single #1 or #2 but when i give like #1,#2,#3,apple the above code... (2 Replies)
Discussion started by: vanitham
2 Replies
8. Shell Programming and Scripting
Hi!
I need the following script:
- All numbers in a filename (0-9) have to be replace by a String ("Zero"-"Nine")
- The script has to go through all the files in the current directory and has to replace the numbers as described above...
I have no idea how to do this...
Thanks!
Michael (5 Replies)
Discussion started by: Michi21609
5 Replies
9. 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
10. 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