because ! is a special char. you need to escape it by "\" if you want to search for it ... if you didn't scape it the system will see it as a negate (not) char .
BR
I have a question. Take the following statement
awk -F\| '{print $21}' testfile | sed 's/\//\\/g' > newfile
This will grab the 21st column of a | delimited text file, replace the forward slashes "/" , with back slashes "\", and redirect the output newfile. Now, how do I get the output... (4 Replies)
Hi,
Below is a small piece of my Korn shell script - what i am trying to do is substitute all occurrences of the word given by the ${src} parameter with the word given by the ${dest} parameter in that particular textfile. But i get the errors below...
for i in `ls... (19 Replies)
Hi,
$ echo 1 titi | sed -e "s/1/$(echo \&)/"
1 titi
but
$ echo 1 titi | sed -e "s/1/$(date \&)/"
date: invalid date `&'
titi
how can i do for handle '\&' with date ?
Thx (7 Replies)
Hi.
I'm going to learn scripting and i have the following topics on the list: sed, awk, shell scripting, perl.
My question is, whehter i should learn sed and awk? Aren't this tools outdated?
Although i see that GNU upgrade it's versions of these tools from time to time.
And, the next... (9 Replies)
Hello everyone,
i wonder if someone could give me an advice regarding the following problem using sed.
Given ist a structure as shown below:
<aaa>text1<b>text2</b>text3<c>text4</c>text5</aaa>
Now I want to change the outer tag from "aaa" to "new" and replace all tags inside the outer tags... (4 Replies)
I am searching for a specific pattern and replacing with ( ) for matched pattern .I am not getting the expected result .....
Here is the file
cat test
cool
change
Frinto Francis
Frinto cool
change Attitude
/usr/bin
sed 's/*/( & )/' test
( cool )
( change )
( )Frinto Francis... (2 Replies)
Hi,
I can't seem to understand what the sed and & do.. Why is the set of numbers appear twice ? how the command really work ?
echo "123 abc" | sed 's/*/& www &/'
Output:
123 www 123 abc (3 Replies)
I want to know the working of & here step by step using sed command. (1 Reply)
Discussion started by: Preeti07
1 Replies
LEARN ABOUT REDHAT
escape
escape(1) Mail Avenger 0.8.3 escape(1)NAME
escape - escape shell special characters in a string
SYNOPSIS
escape string
DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result.
EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string:
$ var='; echo gotcha!'
$ eval echo hi $var
hi
gotcha!
$
Using escape, one can avoid executing the contents of $var:
$ eval echo hi `escape "$var"`
hi ; echo gotcha!
$
A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For
example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient:
#!/bin/sh
formail -x to -x cc -x resent-to -x resent-cc
| fgrep "$1" > /dev/null
&& exit 0
echo "<$1>.. address does not accept blind carbon copies"
exit 100
To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt
script:
bodytest reject_bcc `escape "$RECIPIENT"`
SEE ALSO avenger(1),
The Mail Avenger home page: <http://www.mailavenger.org/>.
BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells.
AUTHOR
David Mazieres
Mail Avenger 0.8.3 2012-04-05 escape(1)