Sponsored Content
Top Forums Shell Programming and Scripting sed global substitution for ' character Post 302270371 by borderblaster on Sunday 21st of December 2008 02:20:14 PM
Old 12-21-2008
sed global substitution for ' character

Hi all,

I have a text file containing sql commands. I want to use sed to replace the " character with the ' character. But when i run the command below it just replaces it with a space? Do i have the escape the ' character if i want to use it?

cat sql.txt

update customer set custid = 'test" where number = 50041;
update customer set custid = 'test2" where number = 50042;
update customer set custid = 'test3" where number = 10393;

$ cat sql.txt | sed 's/"/'/g

update customer set custid = 'test where number = 50041;
update customer set custid = 'test2 where number = 50042;
update customer set custid = 'test3 where number = 10393;
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

character substitution

Hi , I have a problem , I need to devlope a script where in the user inputs file name , line number , and character position , and a substitution variable , the character at that character position should be substituted by the substitution value for ex say i have a file abc.txt which... (3 Replies)
Discussion started by: viv1
3 Replies

2. UNIX for Advanced & Expert Users

global substitution in VI

Hi All, I'm trying to add a carriage return to the end of my lines in a text file using substitution, but I havent found a way as yet. Can anyone help? something along the lines of: :%s/<^A/^M/g obviously, this doesnt work. Many thanks. (11 Replies)
Discussion started by: OLweiser
11 Replies

3. Shell Programming and Scripting

Global replace with sed

Hi, I need to change some strings from A to B in a number of files within a directory. Please can someone advise how do I do that? Many thanks (5 Replies)
Discussion started by: canary
5 Replies

4. UNIX for Dummies Questions & Answers

global search and replacement of a non-ascii character

Hi, I need to do a global search and replacement of a non-ascii character. Let me first give the background of my problem. Very frequently, I need to copy set of references from different sources. Typically, a reference would like this: Banumathy et al., 2002 G. Banumathy, V. Singh and U.... (1 Reply)
Discussion started by: effjay
1 Replies

5. Shell Programming and Scripting

Sed character substitution

Hi I have to replace in around 60 files a word an replcae it by another Suppose all the files have a word intelligent i want to replace it by idiot I am planning to use sed for executing this job sed 's/\intelligent/idiot/g' I plan to have a file (test.txt) which contains... (1 Reply)
Discussion started by: ultimatix
1 Replies

6. Shell Programming and Scripting

In Sed how can I replace starting from the 7th character to the 15th character.

Hi All, Was wondering how I can do the following.... I have a String as follows "ACCTRL000005022RRWDKKEEDKDD...." This string can be in a file called tail.out or in a Variable called $VAR2 Now I have another variable called $VAR1="000004785" (9 bytes long), I need the content of... (5 Replies)
Discussion started by: mohullah
5 Replies

7. Shell Programming and Scripting

KSH: substitution character, AWK or SED?

Hi Gurus, I am working with a korn shell script. I should replace in a very great file the character ";" with a space. Example: 2750;~ 2734;~ 2778;~ 2751;~ 2751;~ 2752;~ what the fastest method is? Sed? Awk? Speed is dead main point, Seen the dimensions of the files Thanks (6 Replies)
Discussion started by: GERMANICO
6 Replies

8. Shell Programming and Scripting

ksh - Get last character from string - Bad Substitution error

I want to get the last character from my machine name using the following code, the default shell is bash, the script runs in ksh. I get 'bad' substitution error on running the script, but works fine if run using dot and space. Why? $ echo $0 bash $ cat -n myenv.sh 1 ... (8 Replies)
Discussion started by: ysrini
8 Replies

9. UNIX for Beginners Questions & Answers

(g)awk conditional substitution issues when attempting to delete character

A portion of my input is as follows: 1087 IKON01,49 A WA- -1 . -1 . 0 W WA- -1 . -1 . 0 . -1 . -1 -1 -1 -1 -1 -1 W 1088 IKON01,49 A J.@QU80MW. 2... (2 Replies)
Discussion started by: jvoot
2 Replies

10. Shell Programming and Scripting

sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi, Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank. Text file : "1"|"ExternalClassDEA519CF5"|"Art1" "2"|"ExternalClass563EA516C"|"Art3" "3"|"ExternalClass305ED16B8"|"Art9" ... ... ... (2 Replies)
Discussion started by: fspalero
2 Replies
WDMD(8) 						      System Manager's Manual							   WDMD(8)

NAME
wdmd - watchdog multiplexing daemon SYNOPSIS
wdmd [OPTIONS] DESCRIPTION
This daemon opens /dev/watchdog and allows multiple independent sources to detmermine whether each KEEPALIVE is done. Every test interval (10 seconds), the daemon tests each source. If any test fails, the KEEPALIVE is not done. In a standard configuration, the watchdog timer will reset the system if no KEEPALIVE is done for 60 seconds ("fire timeout"). This means that if a single test fails 5-6 times in row, the watchdog will fire and reset the system. With multiple test sources, fewer separate failures back to back can also cause a reset, e.g. T seconds, P pass, F fail T00: test1 P, test2 P, test3 P: KEEPALIVE done T10: test1 F, test2 F, test3 P: KEEPALIVE skipped T20: test1 F, test2 P, test3 P: KEEPALIVE skipped T30: test1 P, test2 F, test3 P: KEEPALIVE skipped T40: test1 P, test2 P, test3 F: KEEPALIVE skipped T50: test1 F, test2 F, test3 P: KEEPALIVE skipped T60: test1 P, test2 F, test3 P: KEEPALIVE skipped T60: watchdog fires, system resets (Depending on timings, the system may be reset sometime shortly before T60, and the tests at T60 would not be run.) A crucial aspect to the design and function of wdmd is that if any single source does not pass tests for the fire timeout, the watchdog is guaranteed to fire, regardless of whether other sources on the system have passed or failed. A spurious reset due to the combined effects of multiple failing tests as shown above, is an accepted side effect. The wdmd init script will load the softdog module if no other watchdog module has been loaded. wdmd cannot be used on the system with any other program that needs to open /dev/watchdog, e.g. watchdog(8). Test Source: clients Using libwdmd, programs connect to wdmd via a unix socket, and send regular messages to wdmd to update an expiry time for their connection. Every test interval, wdmd will check if the expiry time for a connection has been reached. If so, the test for that client fails. Test Source: scripts wdmd will run scripts from a designated directory every test interval. If a script exits with 0, the test is considered a success, other- wise a failure. If a script does not exit by the end of the test interval, it is considered a failure. OPTIONS
--version, -V Print version. --help, -h Print usage. --dump, -d Print debug information from the daemon. --probe, -p Print path of functional watchdog device. Exit code 0 indicates a functional device was found. Exit code 1 indicates a functional device was not found. -D Enable debugging to stderr and don't fork. -H 0|1 Enable (1) or disable (0) high priority features such as realtime scheduling priority and mlockall. -G name Group ownership for the socket. -S 0|1 Enable (1) or disable (0) script tests. -s path Path to scripts dir. -k num Kill unfinished scripts after num seconds. -w path The path to the watchdog device to try first. 2011-08-01 WDMD(8)
All times are GMT -4. The time now is 11:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy