Sponsored Content
Full Discussion: sed syntax error
Top Forums Shell Programming and Scripting sed syntax error Post 302836987 by royalibrahim on Thursday 25th of July 2013 02:32:20 AM
Old 07-25-2013
sed syntax error

Hi,

In the following excerpt of shell script code: I could not understand the sed syntax. Could anyone shed some light on this?

Code:
configure_ssl()
{
    jboss_conf_file=$1
    echo "Configuring SSL for -" ${jboss_conf_file}

    isSSLSetup=`echo cat ${jboss_conf_file} | grep <Connector port=\"${jboss_ssl_port}\"`
    echo "isSSLSetup - " ${isSSLSetup}
    if [ -z ${isSSLSetup} ];then
        echo " Connector already present. Existing..."
    else

    sed -e "/.*<Connector port=\"8080\"/ { \
\
<Connector port=\"${jboss_ssl_port}\"  address=\"$\{jboss.bind.address\}\" \
\
maxThreads=\"100\" minSpareThreads=\"5\" maxSpareThreads=\"75\" \
\
scheme=\"https\" secure=\"true\" clientAuth=\"false\" \
\
keystoreFile=\"${keystore_file}\" \
\
sslProtocol=\"TLS\" /> \
};" -i ${CONTROL_PANEL_REPOS_DIR}${jboss_conf_file}

  fi
#    sed -e "/.*<Connector port=\"8080\"/ { <Connector port=\"${jboss_ssl_port}\"  address=\"$\{jboss.bind.address\}\" maxThreads=\"100\" minSpareThreads=\"5\" maxSpareThreads=\"75\" scheme=\"https\" secure=\"true\" clientAuth=\"false\" keystoreFile=\"${keystore_file}\" sslProtocol=\"TLS\" /> };" -i ${CONTROL_PANEL_REPOS_DIR}${jboss_conf_file}

    if [ $? -eq 0 ]; then
	    echo "SSL was setup successfully for -" ${jboss_conf_file}
    else
	    echo "SSL setup failed for -" ${jboss_conf_file}
    fi
}

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sed syntax

Hi, How can i use sed command to modify a part of a variable containing "/" by another containing "/" like describe below: VAR="/app/share/eai" VAR1="/app/share" VAR2="/data/test" echo $VAR | sed 's/... ??? # using sed to replace $VAR1 in $VAR by $VAR2 ? (4 Replies)
Discussion started by: jo_aze
4 Replies

2. Shell Programming and Scripting

syntax for variables in sed

I always kind of wondered this but I have a variable that I want to use in a search and replace. Basically I want to search a file for the string in my variable and replace it with something fixed but I'm unsure of the variable rule in sed. Here's generally what I have: sed 's/$name/newname/g'... (15 Replies)
Discussion started by: eltinator
15 Replies

3. Shell Programming and Scripting

sed error : Syntax error: redirection unexpected

My script is throwing the error 'Syntax error: redirection unexpected' My line of code.. cat nsstatustest.html | sed s/<tr><td align="left">/<tr><td align="left" bgcolor="#000000"><font color="white">/ > ztmp.Ps23zp2s.2-Fpps3-wmmm0dss3 HTML tags are getting in the way but they're needed to... (3 Replies)
Discussion started by: phpfreak
3 Replies

4. Shell Programming and Scripting

What syntax to use with sed c\

I know that I want to entirely replace line 3 in my file filename.txt. I have tried all sorts of variations of sed 3,3,c\replacement stuff\ filename.txt with no success. about the only thing that causes any reaction is sed 3,3c\\ filename.txt but it just prints out the whole file. ... (13 Replies)
Discussion started by: SusanDAC
13 Replies

5. Shell Programming and Scripting

Explain following sed syntax please

Thanks to this forum I have managed to work out a solution to my problem and actually understand most of it, but one thing is confusing me and I am sure someone here can explain. I need to insert a piece of txt into a file. This txt is awk '{ sub(/$/,"\r"); print }' $JCL_WBB50103_EFTOUT >... (2 Replies)
Discussion started by: hukcjv
2 Replies

6. UNIX for Dummies Questions & Answers

sed - need help for syntax

Hello, here is what I've got : FILE='/OPERATIONNEL/SATURNE/CHAMPS/MASTER/ANA/SATURNE_1DAV_20080805_20080806_S3D_T_R20080806.NC ';;... (4 Replies)
Discussion started by: Aswex
4 Replies

7. Shell Programming and Scripting

sed s/// syntax help

<tr><td width=10% style='width:5%;background:#F7F0D9;padding:0in 0in 0in 0in 0in'><center><b>Package</b></td><td width=10% valign=center style='width:5%;background:#F7F0D9;padding:0in 0in 0in 0in 0in'><center><b>JTs</b></td> This is got to be simple. I run this on the above .html file: sed... (8 Replies)
Discussion started by: dba_frog
8 Replies

8. Shell Programming and Scripting

bc syntax error due to sed

Hi all, before posting this questions i have looked up and found similar cases as the one i have but none of them had the answer i was lookink for. i have the next two commands (with their corresponding output) e1=$(grep KCAL input.OUT | sed 's/ FINAL HEAT OF FORMATION = ... (2 Replies)
Discussion started by: ezitoc
2 Replies

9. Shell Programming and Scripting

Another sed Syntax Puzzle . . .

Greetings! Have a quick question for the community today; this time looking at a nifty little sed puzzle ;) Consider the following file content to be worked through:What needs to happen is theblock should be removed up to and including the following blank line, leavingI have bits and pieces... (8 Replies)
Discussion started by: LinQ
8 Replies

10. UNIX for Dummies Questions & Answers

Can sed use a file on the syntax?

Dear all, I need help, again. I would like to use a sed on a for. Is is possible to ask sed to call a file in the syntax? For exemple: sed "/Y/ s/number/X/" test_imput > test_output where Y is a file which inside there is one pattern only; Also X is a file with one... (6 Replies)
Discussion started by: lColli
6 Replies
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)
All times are GMT -4. The time now is 01:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy