Sponsored Content
Top Forums Shell Programming and Scripting sed with complicated variable pattern Post 302529404 by pravintse on Thursday 9th of June 2011 09:18:32 AM
Old 06-09-2011
sed with complicated variable pattern

Hi,
Below is the content of the file how it looks:
# EMAIL
#export BMS_EMAIL_ENABLED=true
export BMS_EMAIL_ENABLED=false
#export BMS_EMAIL_SERVER=esasmtp01.kohls.com
export BMS_EMAIL_SERVER=esasmtp01.kohls.com.SMTP_SERVICE
export BMS_EMAIL_FROM_ADDRESS=ec_notify@kohlsectest.com
export BMS_EMAIL_TO_ADDRESS=ec_notify@kohlsectest.com

Here, I want to replace this line
#export BMS_EMAIL_ENABLED=true
with
export BMS_EMAIL_ENABLED=true. Removing #. There are several fields in the file which can have #export, so cannot use this
Code:
sed -i '' -e's/#export/export/' pravinkumartse.env

I'm trying with this
Code:
sed -i '' -e"s/#${svar5}/${svar5}/" pravinkumartse.env

But it removes # all over the file along with substituting.

variable svar5 has the value as 'export BMS_EMAIL_ENABLED=true'.

Problem here is the search term i'm using in sed - #${svar5}.
Please help me.

Last edited by fpmurphy; 06-09-2011 at 10:42 AM.. Reason: Removed embedded mailto link
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help in sed command ( Replacing a pattern inside a file with a variable value )

Hello, The following sed command is giving error sed: -e expression #1, char 13: unknown option to `s' The sed command is echo "//-----" | sed "s/\/\/---*/$parChk/g" where parChk="//---ee-" How can i print the variable value from sed command ? And is it possible to replace a... (2 Replies)
Discussion started by: frozensmilz
2 Replies

2. Shell Programming and Scripting

assigning complicated input to a variable

I cannot seem to correctly assign this line of code to a variable: HITS=`pwd`/csv/LightningProbability30minAlignmentErrorTable_*.csv | sed 's/,/ /g' | awk '{print int(100*$5)}' | wc This does not work. I tried surrounding it in backticks, but I think the backticks in `pwd` is messing it... (10 Replies)
Discussion started by: sigtor77
10 Replies

3. Emergency UNIX and Linux Support

Complicated SED search required

Hi All, I'm trying to extract all the description fields from a MIB file which contain multiple instances of the following text: ENTERPRISE compaq VARIABLES { sysName, cpqHoTrapFlags, cpqSsBoxCntlrHwLocation, cpqSsBoxCntlrIndex, cpqSsBoxBusIndex,... (10 Replies)
Discussion started by: badoshi
10 Replies

4. Shell Programming and Scripting

Parsing complicated CSV file with sed

Yes, there is a great doc out there that discusses parsing csv files with sed, and this topic has been covered before but not enough to answer my question (unix.com forums). I'm trying to parse a CSV file that has optional quotes like the following: "Apple","Apples, are fun",3.60,4.4,"I... (3 Replies)
Discussion started by: analog999
3 Replies

5. UNIX for Advanced & Expert Users

complicated date stamp pattern

Hi, I have a log file which contains lines like below: 2010-07-19 07:13:19,021 ERROR system ...(text) 2010-07-19 07:22:03,427 ERROR system ...(text) class com... (text) 2010-07-19 07:23:19,026 ERROR system ...(text) class com... (text) each line is a separate line... I am given the a... (11 Replies)
Discussion started by: a27wang
11 Replies

6. Shell Programming and Scripting

Pattern match exclusive return pattern/variable

I have an application(Minecraft Server) that generates a logfile live. Using Crontab and screen I send a 'list' command every minute. Sample Log view: 2013-06-07 19:14:37 <Willrocksyea1> hello* 2013-06-07 19:14:41 <Gromden29> hey 2013-06-07 19:14:42 Gromden29 lost connection:... (1 Reply)
Discussion started by: gatekeeper258
1 Replies

7. Shell Programming and Scripting

Regex in sed to find specific pattern and assign to variable

(5 Replies)
Discussion started by: radioactive9
5 Replies

8. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

9. Shell Programming and Scripting

How to delete all lines before a particular pattern when the pattern is defined in a variable?

I have a file Line 1 a Line 22 Line 33 Line 1 b Line 22 Line 1 c Line 4 Line 5 I want to delete all lines before last occurrence of a line which contains something which is defined in a variable. Say a variable var contains 'Line 1', then I need the following in the output. ... (21 Replies)
Discussion started by: Soham
21 Replies

10. Shell Programming and Scripting

sed with pattern using variable

Dear Community; I have a long xml file (100k+ lines) with patterns like below: <OfferDefinition Id="123"> <Type>Timer</Type> <Description>Test Text1</Description> <MajorPriority>95</MajorPriority> <SelectableInPolicy>0</SelectableInPolicy> ... (10 Replies)
Discussion started by: mystition
10 Replies
SEQDIAG(1)						      General Commands Manual							SEQDIAG(1)

NAME
seqdiag - generate sequence-diagram image file from spec-text file. SYNOPSIS
seqdiag [options] file DESCRIPTION
This manual page documents briefly the seqdiag commands. seqdiag is generate sequence-diagram image file from spec-text file. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. --version show program's version number and exit -h, --help show this help message and exit -a, --antialias Pass diagram image to anti-alias filter -c FILE, --config=FILE read configurations from FILE -o FILE write diagram to FILE -f FONT, --font=FONT use FONT to draw diagram -T TYPE Output diagram as TYPE format SEE ALSO
The programs are documented fully by http://tk0miya.bitbucket.org/seqdiag/build/html/index.html AUTHOR
seqdiag was written by Takeshi Komiya <i.tkomiya@gmail.com> This manual page was written by Kouhei Maeda <mkouhei@palmtb.net>, for the Debian project (and may be used by others). May 21, 2011 SEQDIAG(1)
All times are GMT -4. The time now is 02:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy