Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help with search and replace or search only of / in vi Post 302628779 by zaxxon on Tuesday 24th of April 2012 03:06:10 AM
Old 04-24-2012
I usually escape them, but you could start from the end of the file using ? to initiate a search (so hit [shift+g] to get to the end first). It doesn't need slashes to be escaped this way.
This User Gave Thanks to zaxxon For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

2. Shell Programming and Scripting

search and replace

i have the following create table definition ,the shell script has to search for the first column name of the create table definition in the file and explicitly add primary index (first column name) at the end i.e before ";" it has to search through all the files (say 20 files) and has to... (1 Reply)
Discussion started by: a.suryakumar
1 Replies

3. Shell Programming and Scripting

Search n replace...

Hi, Can anyone help me with the command to do the following search and replace 209560100000003-000002590688F402 0020031028210 209560100000003-000002590688W302 0040031028210 search and replace anything that has "F4” in column 30 with ‘W3’ and copy line into new file if the... (3 Replies)
Discussion started by: kate katherine
3 Replies

4. Shell Programming and Scripting

awk - replace number of string length from search and replace for a serialized array

Hello, I really would appreciate some help with a bash script for some string manipulation on an SQL dump: I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump. This is quite easy with sed: sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies

5. Shell Programming and Scripting

search and replace

Hi, I am trying to obtain a string from a file and replace it in another file. Here is my code # Environment Variables CRED_PATH=/fxxxx/testpwd/ CRED_FILE=password.credential DOMAIN_CFG=/fxxxx/testpwd/ CFG_FILE=file.xml NEW_PWD=`cat ${CRED_PATH}${CRED_FILE}` #echo $NEW_PWD... (5 Replies)
Discussion started by: userscript
5 Replies

6. Shell Programming and Scripting

perl search and replace - search in first line and replance in 2nd line

Dear All, i want to search particular string and want to replance next line value. following is the test file. search string is tmp,??? ,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50 tmp,123 --- if match tmp,??? then... (3 Replies)
Discussion started by: arvindng
3 Replies

7. Shell Programming and Scripting

Search and Replace

hi all, I have an xml and which has a section <!ENTITY commonssf1lymphoma SYSTEM "commons/commonssf1lymphoma.xml"> <!ENTITY commonssf2lymphoma SYSTEM "commons/commonssf2lymphoma.xml"> <!ENTITY commonssf3lymphoma SYSTEM "commons/commonssf3lymphoma.xml"> i want to replace... (9 Replies)
Discussion started by: r_t_1601
9 Replies

8. UNIX for Dummies Questions & Answers

Search and Replace

I am trying to search and replace using two different files with strict search rules. One file contain some data and the other file contain some numbers as shown below. DataFile.txt >L1_T1 text data... text data.. >L1_T1 text data... text data.. >L1_T1 text data... text data.. ........ (4 Replies)
Discussion started by: Fahmida
4 Replies

9. Shell Programming and Scripting

Search and replace value

I have a Parameter.txt file with set of parameters which i need to replace $$ControlM_Job_Name value with respective to job which i need to run.currently $$ControlM_Job_Name have PRDDWG-HLBIDW-INTREPID-SPS value i want to replce with HLBIDW-INTREPID value.is there any command which can achive this.... (1 Reply)
Discussion started by: katakamvivek
1 Replies

10. Shell Programming and Scripting

Nested search in a file and replace the inner search

Hi Team, I am new to unix, please help me in this. I have a file named properties. The content of the file is : ##Mobile props east.url=https://qa.east.corp.com/prop/end west.url=https://qa.west.corp.com/prop/end south.url=https://qa.south.corp.com/prop/end... (2 Replies)
Discussion started by: tolearn
2 Replies
STR_IREPLACE(3) 							 1							   STR_IREPLACE(3)

str_ireplace - Case-insensitive version ofstr_replace(3).

SYNOPSIS
mixed str_ireplace (mixed $search, mixed $replace, mixed $subject, [int &$count]) DESCRIPTION
This function returns a string or an array with all occurrences of $search in $subject (ignoring case) replaced with the given $replace value. If you don't need fancy replacing rules, you should generally use this function instead of preg_replace(3) with the i modifier. PARAMETERS
If $search and $replace are arrays, then str_ireplace(3) takes a value from each array and uses them to search and replace on $subject. If $replace has fewer values than $search, then an empty string is used for the rest of replacement values. If $search is an array and $replace is a string, then this replacement string is used for every value of $search. The converse would not make sense, though. If $search or $replace are arrays, their elements are processed first to last. o $search - The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. o $replace - The replacement value that replaces found $search values. An array may be used to designate multiple replacements. o $subject - The string or array being searched and replaced on, otherwise known as the haystack. If $subject is an array, then the search and replace is performed with every entry of $subject, and the return value is an array as well. o $count - If passed, this will be set to the number of replacements performed. RETURN VALUES
Returns a string or an array of replacements. EXAMPLES
Example #1 str_ireplace(3) example <?php $bodytag = str_ireplace("%body%", "black", "<body text=%BODY%>"); ?> NOTES
Note This function is binary-safe. Caution Replacement order gotcha Because str_ireplace(3) replaces left to right, it might replace a previously inserted value when doing multiple replacements. Example #2 in the str_replace(3) documentation demonstrates how this may affect you in practice. SEE ALSO
str_replace(3), preg_replace(3), strtr(3). PHP Documentation Group STR_IREPLACE(3)
All times are GMT -4. The time now is 01:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy