Sponsored Content
Top Forums Shell Programming and Scripting SED replacement of placeholders Post 302625687 by bhaskar_m on Wednesday 18th of April 2012 06:15:42 AM
Old 04-18-2012
SED replacement of placeholders

Hi All,

I am facing a problem while using SED in Linux.

I have a property file which contains a string
Code:
local.mds.dir=${basedir}/deployComposites

It has be to replaced with another string, and value of that string should be initialized at runtime. So I use placeholder there. My substituted string should look like
Code:
local.mds.dir=${WORKSPACE}/${TAG_DIR}/mds

where
Code:
WORKSPACE=/usr/hudson/.hudson/jobs/temp/workspace
TAG_DIR=1.1.2

So after substitution it should look like
Code:
local.mds.dir=/usr/hudson/.hudson/jobs/temp/workspace/1.1.2/mds

I am using sed command
Code:
sed 's/local.mds.dir=${basedir}\/deployComposites/local.mds.dir=${WORKSPACE}\/${TAG_DIR}\/mds/g' ${PROPERTIES_FILE}

But only placeholder is coming there, not the values are populated. After running the SED it apprears

Code:
local.mds.dir=${WORKSPACE}/${TAG_DIR}/mds

it seems sed is not getting the values
Any ideas where I am going wrong? I am happy to use any other substitution commands as well

Thanks in advance,
Bhaskar
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

placeholders in file names

I am writing a script that looks for files. I need to know if there is a placeholder character when doing this. I know that you can user a wildcard (*) character, but I would prefer to be a bit more specific. When I get files in a specific directory, I know part of the name, but not the rest and... (7 Replies)
Discussion started by: dsimpg2
7 Replies

2. UNIX for Dummies Questions & Answers

Replacement using sed

Hi I have the following file that i need to run a sed command on 1<tab>running 2<tab>running 3<tab>running 4<tab>running I want to be able to replace a line i.e the second one with '2<tab>failed'. As the first number is unique that can be used to search for the relevant line (using ^2 i... (5 Replies)
Discussion started by: handak9
5 Replies

3. Shell Programming and Scripting

Replacement of sed with perl

Hi using the below cmd i am identifying wheether last character in each line in thousands of files as semicolon or not.If last character is semicolon i am removing semicolon .If last character is not semicolon then i am appending next line to present line . For example my input file consists of... (4 Replies)
Discussion started by: dbsurf
4 Replies

4. Shell Programming and Scripting

Need Replacement for sed

Hi Can anyone provide me the replacement of sed with xargs perl syntax for the below sed -e :a -e '/;$/!N;s/\n//; ta' -e 's/;$//' This should be without looping has to take minimal time for search (0 Replies)
Discussion started by: dbsurf
0 Replies

5. Shell Programming and Scripting

sed replacement, challenge one!!!!

Hi all, Thanks in advanced. This question really bothered me much. What i want is to replace any times of repeated 'TB' to 'T', below is example. It can be fullfil by AWK and perl, but my desire is using SED to realize it. So here means we treat TB as a whole part, which means 's/TB*/T/'... (4 Replies)
Discussion started by: summer_cherry
4 Replies

6. Shell Programming and Scripting

Help with sed replacement

This seems like it should be an easy problem, but I'm a noob and I can't figure it out. I'm trying to use sed, but would be happy to use anything that does the job. I am trying to trim off a fixed number of unknown characters from 2 different : delimited fields while keeping the intervening... (4 Replies)
Discussion started by: helix_w
4 Replies

7. Shell Programming and Scripting

Replacement with sed

I am trying to replace the line which has string "tablespace" not case senstive.... with below simple script: mysrcipt.sh sed "s/.*/TABLESPACE USERS/g" create_table > tmp mv tmp create_table Is there any better way to do it? If Search string tooooooo long it will be tough to code in... (4 Replies)
Discussion started by: ganeshd
4 Replies

8. Shell Programming and Scripting

SED replacement

Hi, i have a file with lines, file.txt ------- test is fun testing is better I need to replace 'test' to 'develop' and i used, a=test b=develop sed "s,$a,$b,g" -------- but i see the word 'testing' is also replaced. Need some solution. Is there any way i could replace only 'test' ? (4 Replies)
Discussion started by: giri_luck
4 Replies

9. Shell Programming and Scripting

sed replacement error

Hi ,"environment":"accent-release","build":"ac-1112_c_Alph_Nop-release_rele-1112_c_Alph_Nop-release_rele","tags":"" above is the config file, where in i want to replace value after build inside the double quotes... that value i'll be passing as parameter for example if m passing ... (1 Reply)
Discussion started by: nikhil jain
1 Replies

10. Shell Programming and Scripting

sed text replacement

Hello, I'm using Bash and Sed to replace text within a text file (1.txt) twice in one script. Using a for loop I'm initially replacing any 'apple' words with the variable 'word1' ("leg). I'm then using another for loop to replace any 'apple' words with the variable 'word2' ("arm"). This task is... (2 Replies)
Discussion started by: Flip-Flop
2 Replies
MDDIAGNOSE(8)						    BSD System Manager's Manual 					     MDDIAGNOSE(8)

NAME
mddiagnose -- gather information to aid in diagnosing Spotlight issues SYNOPSIS
mddiagnose -h mddiagnose [-f path] [-e path] [-p path] [-n] DESCRIPTION
The mddiagnose tool gathers system and Spotlight information in order to assist Apple when investigating issues related to Spotlight. A great deal of information is harvested, spanning system state, system and Spotlight details. What mddiagnose Collects: o A spindump of the system o Several seconds of top output o Individual samples of mds and mdworker o Paths for all files used by Spotlight to contain its database on every volume o All system logs o All spin and crash reports for the following processes: mds mdworker o Recent spin and crash reports for the following processes, for all local users: mds mdworker o The query text and result quality statistics for recent Spotlight searches. The actual results of the searches are not gathered o General information about disks and mounted network shares o The path of the last file indexed by each mdworker process on behalf of Spotlight. The path of the last file which resulted in a crash of an mdworker process. In each case, only the path is gathered, not the contents of the file o Spotlight configuration for each volume currently mounted on your system. This includes the path and size of all files used inter- nally by Spotlight as well as a listing of paths that are user excluded from indexing o Comprehensive information about internal state of Spotlight What mddiagnose Doesn't Collect: o No user data is harvested from any volume o No paths or files found by any search are returned o No database storage or user files are returned o No authentication credentials are harvested from the system OPTIONS
-h Print full usage. -m Gather a subset of the normal report. -f path Write the diagnostic to the specified path. -p path Gather Spotlight permissions and filter information. Run as owner of that file. EXIT STATUS
mddiagnose exits with status 0 if there were no internal errors encountered during the diagnostic, or >0 when an error unrelated to external state occurs or unusable input is provided by the user. Mac OS X 15 March 2011 Mac OS X
All times are GMT -4. The time now is 05:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy