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
Hello
I would like to get know how to do this:
I got a big file (about 1GB) and I need to find a string (for instance by grep )
and then find all records in this file based on a string.
Thanks for advice.
Martin (12 Replies)
Discussion started by: mape
12 Replies
4. Shell Programming and Scripting
I have two files
1. input.txt
2. keyword.txt
input.txt has contents like
.src_ref 0 "call.s" 24 first
0x000000 0x5a80 0x0060 BRA.l 0x60
.src_ref 0 "call.s" 30 first
0x000002 0x1bc5 RETI
.src_ref 0 "call.s" 31 first
0x000003 0x6840 ... (2 Replies)
Discussion started by: acdc
2 Replies
5. Linux
Hi all,
I have a question..
Here is my requirement..I have 500 files in a path say /a/b/c
I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
Discussion started by: us_pokiri
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
Need a perl script to read lines in a file, scan for a string named "APPLE" and write to different file the only lines containing the matched string. (5 Replies)
Discussion started by: PrasannaKS
5 Replies
8. 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
9. Shell Programming and Scripting
Hi,
In principle I am searching for a Perl equivalent for this sed command:
sed "/TIM_AM_ARGS=/ s/60/1440/" $EDIT_FILE > $TEMP_FILE
cp $TEMP_FILE $EDIT_FILE
I was wondering if it needs to be like this, or that there other, shorter, alternatives:
open (TIMENVFILE, "<$timenvfile") or die... (5 Replies)
Discussion started by: ejdv
5 Replies
10. UNIX for Dummies Questions & Answers
HI
In my script, i am reading the input from the user and want to find the length of the string.
The input may contain leading spaces. Right now, when leading spaces are there, they are not counted.
Kindly help me
My script is like below. I am using the ksh.
#!/usr/bin/ksh
echo... (2 Replies)
Discussion started by: dayamatrix
2 Replies