Sponsored Content
Top Forums Shell Programming and Scripting sed: how to replace regex with a ' (quote) mark Post 302340960 by CraigMoore on Tuesday 4th of August 2009 07:18:21 PM
Old 08-04-2009
Question sed: how to replace regex with a ' (quote) mark

I've got a text file which has " marks where it there should be ' marks. I tried to do it with sed, but it won't allow me to escape the ' mark.

Here's what I tried to do:
Code:
sed 's/"/\\'/g' file.txt

How can this be done?

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

single or double quote in SED

i m trying the following command but its not working: sed 's/find/\'replace\'/g' myFile but the sed enters into new line # sed 's/find/re\'place/g' myFile > I havn't any idea how to put single quote in my replace string. Your early help woud be appreciated. Thanx (2 Replies)
Discussion started by: asami
2 Replies

2. Shell Programming and Scripting

How to get rid of double quote in sed.

Hi, i am using sed command to grep just a valuable data for my report generating. Thanks to the person who assists me on before thread. the problem that i encounter now is when i executed below command The output will give me like below output in between the data, there is a double quote. How... (6 Replies)
Discussion started by: anakiar
6 Replies

3. Shell Programming and Scripting

Regex in grep to match all lines ending with a double quote (") OR a single quote (')

Hi, I've been trying to write a regex to use in egrep (in a shell script) that'll fetch the names of all the files that match a particular pattern. I expect to match the following line in a file: Name = "abc" The regex I'm using to match the same is: egrep -l '(^) *= *" ** *"$' /PATH_TO_SEARCH... (6 Replies)
Discussion started by: NanJ
6 Replies

4. Shell Programming and Scripting

Replace a string in quote to uppercase

Hi, I need to find all strings in single quote and change the case of the string to UPPER. Example: Input: xyz abc ccc 'zxxx7U' dfsdf sdfdd aaa 'oR77' and 'or88' Output: xyz abc ccc 'ZXXX7U' dfsdf sdfdd aaa 'OR77' and 'OR88' Appreciate your help!! Thanks Selva (6 Replies)
Discussion started by: selkum
6 Replies

5. Shell Programming and Scripting

replace a single quote using sed command.

Hi, How do I replace the charachters = '*' to = '^' using Sed commands. As I have several * in the script, thus I have to replace the single quotes too. Please let me know any solution. I have tried the escape character backslash '\' but it doesnt help. sed "s/= \'*\'/=... (2 Replies)
Discussion started by: prachifun
2 Replies

6. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

7. UNIX for Dummies Questions & Answers

find single quote in a string and replace it

Hi, I have variable inside shell script - from_item. from_item = 40.1'1/16 i have to first find out whether FROM_ITEM contains single quote('). If yes, then that need to be replace with two quotes (''). How to do it inside shell script? Please note that inside shell script........ (4 Replies)
Discussion started by: yogichavan
4 Replies

8. Shell Programming and Scripting

Expanding regex in quote

Hi Experts, I'm trying to match and perform the substitution (below) but failed. <File1> Attributes = "SampleAttributes" Attributes1 = "SampleAttributes1" Command: grep Attributes File1 | sed 's|Attributes\s=\s\"\"|Attributes = \"ReplaceAttributes\"|' Any ideas? :( (2 Replies)
Discussion started by: antderu
2 Replies

9. Shell Programming and Scripting

How to replace quote symbol(") and dot(.) with some other values!!

Hi , I have below input file 1.order number is useful. 2.vendor_id is produced. 3.the vandor name is "malawar". I want output file like 1. order number is useful. 2. vendor_id is produced. 3. the vandor name is VmalawarV. in input file line number 1.order number there is no... (4 Replies)
Discussion started by: vinothsekark
4 Replies

10. Shell Programming and Scripting

Replace HTML tags using sed regex

I need all the end tags of </font> to be replaced with new line yet enclosing tag to be retained </font>. Please help me in this regard. Input: <font>abc</font>def<font>ghi</font> Output: <font>abc</font> def <font>ghi</font> (3 Replies)
Discussion started by: Badhrish
3 Replies
prof(5) 							File Formats Manual							   prof(5)

Name
       prof - profile within a function

Syntax
       #define MARK
       #include <prof.h>

       void MARK (name)

Description
       The  symbol  produces  a mark called name that is treated the same as a function entry point.  Execution of the mark increments the counter
       for that mark, and the program-counter time spent is accounted to the preceding mark or to the function if a preceding mark is  not  within
       the active function.

       The  name argument can be any combination of numbers or underscores.  Each name in a single compilation must be unique, but can be the same
       as any ordinary program symbol.

       For marks to be effective, the symbol must be defined before the header file is included.  This may be defined by a preprocessor  directive
       as in the synopsis, or by a command line argument.  For example:
       cc -p -DMARK foo.c
       If is not defined, the statements may remain in the source files, but they will be ignored.

Examples
       In  the following example, marks are used to determine how much time is spent in each loop.  Unless the example is compiled with defined on
       the command line, the marks are ignored:
       #include <prof.h>
       foo( )
       {
	    int i, j;
	    .
	    .
	    .
	    MARK(loop1);
	    for (i = 0; i < 2000; i++) {
		 . . .
	    }
	    MARK(loop2);
	    for (j = 0; j < 2000; j++) {
		 . . .
	    }
       }

See Also
       prof(1), profil(2), monitor(3c)

								       RISC								   prof(5)
All times are GMT -4. The time now is 07:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy