Sponsored Content
Top Forums Shell Programming and Scripting Replace apostrophe with backslash apostrophe Post 302529121 by dbjock on Wednesday 8th of June 2011 02:58:17 PM
Old 06-08-2011
Thank you for the quick reply. I just tried it and it did not work.
To ensure I did this correctly I even changed it to use this:

Code:
xMyVAL=`echo $MyVAL | sed "s/'/WW\'/g"`

So the original text is this:
Original text:
0904 MM - Int'l - Action required

With the code to ensure it would work (putting the WW in there) the new text looked like this:
0904 MM - IntWW'l - Action required

The WW's got in there but for some reason the back slash doesn't.

Any other suggestions?

Last edited by dbjock; 06-08-2011 at 03:59 PM.. Reason: Putting code tags on
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to strip apostrophe from a file

I am trying to remove or replace various extraneous characters from a file so that subsequent processes work correctly. The characters that is giving me trouble is the apostrophe '. The command I 'm trying is sed 's/\'//g' ${IN_WRK_DIR}/file1 > ${IN_WRK_DIR}/file2 in a Korn script on HP... (8 Replies)
Discussion started by: aquimby
8 Replies

2. Shell Programming and Scripting

Escaping apostrophe using shell script

Hi, I am using the KSH shell. I am facing a problem of escaping apostrophe('), that is occuring in a variable. I used the following command, but in vain item=`echo $item|sed 's/'/\'/g'` this code replaces the occurance of ' in an xml file to apostrophe(') symbol. The output of... (2 Replies)
Discussion started by: mradul_kaushik
2 Replies

3. Shell Programming and Scripting

inserting an apostrophe into awk output

hello, I have a simple awk script thus: egrep populateNode logfile.txt | gawk '{print $11}' This gives me a list of usernames. I want to pipe the above command into another command that will surround each username with an SQL insert statement: insert into thetable (username) values... (3 Replies)
Discussion started by: tenakha
3 Replies

4. UNIX for Dummies Questions & Answers

How to replace special chars like " ' " (Apostrophe)

I'm goin to drive crazy soon, if i can not do this. I have a text file (570kb) and i have to replace the apostrophe " ' " and minus "-" with space " ". i have done it for minus: sed 's/-/ /g' aaa.txt >zzz.txt this replaced minus with space. but i can not use the same command for ' . ... (4 Replies)
Discussion started by: onculo
4 Replies

5. Shell Programming and Scripting

script to replace a character with '(Apostrophe)

Hi Friends, I need a sed or awk based script to replace a character(alphabet) with ' (Apostrophe). I tried to use the following two commands 1) sed -e 's/a/'/' filename 2) awk '{sub("a","'",$1);print}' filename but both got failed. Any help on this. Thanks in advance.. (3 Replies)
Discussion started by: ks_reddy
3 Replies

6. Shell Programming and Scripting

Perl - Title Case after apostrophe

I've got: $string =~ s/(\w+)/\u\L$1/g; Which capitalizes each word in the string. The problem is if I have a string with an apostrophe the first letter after it gets capitalized as well. So Bob's becomes Bob'S. Thanks for any quick fixes! (4 Replies)
Discussion started by: mjmtaiwan
4 Replies

7. Programming

How to change only one occurance of apostrophe with sed

Hi, I have a document with usual English text and some of the words have apostrophes (e.g. don't, can't, etc.) I would like all these apostrophes to be doubled (e.g. don''t, can''t, etc.), but the problem is, that some of such words have double apostrophe and by using sed -i "s/'/''/g"... (2 Replies)
Discussion started by: neptun79
2 Replies

8. Shell Programming and Scripting

Remove apostrophe and a letter followed by it

Hi All, For example, I have some words like these: cabinet's school's field's you'll I know how to remove apostrophe from these words using this command: cat filename | tr -s "\'" ' ' But I am not sure how I can remove the letter followed by the apostrophe, so that my output... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

9. Shell Programming and Scripting

Add backslash and apostrophe to string in variable.

Hi All I want to add backslash and apostrophe to variable in my bash script. I have my variable: USER_LIST=USER1,USER2,USER3 and I want something like this: USER_LIST_DEL=/'USER1/',/'USER2/',/'USER3/' any ideas ?? (1 Reply)
Discussion started by: primo102
1 Replies

10. UNIX for Beginners Questions & Answers

Find ' (apostrophe) by grep

hi linux expert how can i find apostrophe (') symbol in text file by grep? for example for find 'test, the command grep " \'test" * is not useful. Many Thanks samad (1 Reply)
Discussion started by: abdossamad2003
1 Replies
Net::CLI::Interact::Action(3pm) 			User Contributed Perl Documentation			   Net::CLI::Interact::Action(3pm)

NAME
Net::CLI::Interact::Action - Sent data or matched response from connected device VERSION
version 1.121640 DESCRIPTION
This class is used internally by Net::CLI::Interact and it's unlikely that an end-user will need to make use of Action objects directly. The interface is documented here as a matter of record. An Action object represents either some kind of text or command to send to a connected device, or a regular expression matching the response from a connected device. Such Actions are built up into ActionSets which describe a conversation with the connected device. If the Action is a "send" type, then after execution it can be cloned and augmented with the response text of the command. If the response is likely to be paged, then the Action may also store instruction in how to trigger and consume the pages. INTERFACE
type Denotes the kind of Action, which may be "send" or "match". value In the case of "send", a String command to send to the device. In the case of "match", a regular expression reference to match response from the device. In special circumstances an array reference of regular expression references is also valid, and each will be checked for a match against the device response. no_ors Only applies to the "send" kind. Whether to skip appending the output record separator (newline) to the "send" command when sent to the connected device. continuation Only applies to the "send" kind. When response output is likely to be paged, this stores an ActionSet that contains two Actions: one for the "match" which indicates output has paused at the end of a page, and one for the "send" command which triggers printing of the next page. params Only applies to the "send" kind, and contains a list of parameters which are substituted into the "value" using Perl's "sprintf" function. Insufficient parameters causes "sprintf" to die. num_params Only applies to the "send" kind, and returns the number of parameters which are required for the current "value". Used for error checking when setting "params". response A stash for the returned prompt which matched and triggered the end of this action. response_stash A stash for the returned output following a "send" command, but not including the matched prompt which ended the action. This slot is used by the "match" action as it slurps output, but the content is then transferred over to the partner "send" in the ActionSet. prompt_hit When a command is successfully issued, the response is terminated by a prompt. However that prompt can be one of a list, defined in the Action. This slot records the regular expression from that list which was actually matched. clone Returns a new Action, which is a shallow clone of the existing one. All the reference based slots will share data, but you can add (for example) a "response" without affecting the original Action. Used when preparing to execute an Action which has been retrieved from the Phrasebook. AUTHOR
Oliver Gorwits <oliver@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Oliver Gorwits. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-12 Net::CLI::Interact::Action(3pm)
All times are GMT -4. The time now is 04:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy