Escape Characters are driving me crazy!

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Escape Characters are driving me crazy!
# 1  
Old 08-20-2009
Escape Characters are driving me crazy!

Hi everyone,

Is there anywhere I can find a complete table of all characters that must be escaped by the various UNIX shells and scripting languages?

It seems every command/shell/scripting language has different rules about what characters must be escaped.

I do a lot of searching and replacing with files that contain all kinds of characters like ^{}[]()!@#$%&*_+=|\<>.,?~`:";' Did I cover them all?

Can anyone point me to a reference list/table of some kind that I can use. I would love to be able to confidently use sed, awk, perl, ksh or whatever to do string manipulation using these characters without constantly having to guess and experiment with what has to be escaped.

Thanks so much!!
# 2  
Old 08-20-2009
They are called shell metacharacters. As long as you POSIX shells (not csh or tcsh for example) the url below will work for you.

Here is a discussion
Handle Metacharacters
# 3  
Old 08-21-2009

This page (badly titled) UNIX Shell Quote has a comparison table of basic metacharacters (and the site has a number of other good tutorials). Newer shells (bash, zsh, ksh) have a more extensive syntax, e.g. for dealing with arrays, string manipulation, etc. For those, you will need to look at man pages, which for shells, are often quite long ... cheers, drl
# 4  
Old 08-25-2009
Thanks! Both links are very helpful!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to escape all special characters?

I have an application which I am integrating with that accepts the password via a CLI. I am running in to issues with passwords that contain special characters. I tried to escape them all, but I ran in to an issue where I cannot escape the characters ' ] My attempt is as follows: $... (2 Replies)
Discussion started by: AMG1978
2 Replies

2. Shell Programming and Scripting

Escape characters

i am executing script from A server which will execute the script in B server , as below. ssh A 'ssh B echo 'select * from testing where name ='test'' i am getting the below output. select * from testing where name=test but i need the output where clause with quotes , tried with... (3 Replies)
Discussion started by: expert
3 Replies

3. UNIX for Dummies Questions & Answers

UNIX/Linux/Distributions - driving me crazy...

Hello there, first of all: I do not want to become a hacker. you cannot do that. you cannot learn that from a book. Don't think I'm some kind of a script-kiddie. now that's settled let's start. I've been trying around with a lot of OS lately. I have backtrack5 installed on my notebook,... (10 Replies)
Discussion started by: Dr. Nick
10 Replies

4. Shell Programming and Scripting

Replace special characters with Escape characters?

i need to replace the any special characters with escape characters like below. test!=123-> test\!\=123 !@#$%^&*()-= to be replaced by \!\@\#\$\%\^\&\*\(\)\-\= (8 Replies)
Discussion started by: laknar
8 Replies

5. UNIX for Dummies Questions & Answers

Variable with @ sign is driving me crazy

Ok so I am working on a command that is going to do a Dig @ a certain IP address which is enclosed in a variable. Now I thought I had this figure out because it works. The problem is that it does not ALWAYS work. the variable is IP= the commands I have tried are dig... (2 Replies)
Discussion started by: MrEddy
2 Replies

6. Shell Programming and Scripting

PERL cgi script... extra character driving me crazy

I'm using a PERL cgi script that uses rrdtool to make graphs. I can't get the syntax correct to use a degree sign (alt+0176 like this ) and also using a variable. If I use single quotes, I can't call the variable. If I use double quotes, there is an extra symbol () before the which goes... (2 Replies)
Discussion started by: audiophile
2 Replies

7. Shell Programming and Scripting

Pleas help..this is driving me crazy

Hi, I've created a script in csh that takes a file and checks it for mispelled words. Im almost done but I need to do two more things but I need help. First, when displaying an incorrect word to the user, I need to show the line of the input file that contains the word. Second,if the user... (0 Replies)
Discussion started by: hckygoli31
0 Replies

8. Shell Programming and Scripting

Searching for escape characters

Hi all I have been trying to write a script to look for a set of specific escape characters in a file. On viewing the file via vi it shows this : ^ I understand this means no end of line. I have tried a vary of grep parameters such as grep ^\^. filename grep --binary-file=binary without... (8 Replies)
Discussion started by: timcs
8 Replies

9. Shell Programming and Scripting

escape characters..

hey i want to know the unix commands to replace all the character escape sequences with their "C" values in a string... thanks in advance..! Regards, Sharanya (9 Replies)
Discussion started by: sharsin2001
9 Replies

10. UNIX for Dummies Questions & Answers

unix driving me crazy

:( :confused: what is performed by the following unix command: grep -v Jane project1.txt and grep ' 5\..' janet.txt (1 Reply)
Discussion started by: Tendernisin
1 Replies
Login or Register to Ask a Question