Sponsored Content
Top Forums Shell Programming and Scripting sed: command garbled - when executed with $variables Post 302315087 by Armaan_S on Monday 11th of May 2009 12:43:45 PM
Old 05-11-2009
sed: command garbled - when executed with $variables

I have got a file job_tree.lst , which contains 1 line as below

$ cat job_tree.lst
ABC_D_EQ_XXXXX_YYYY_PRD_UX 05/08/2009 05:47 05/08/2009 05:50 IN 13412850/0

I want to get a child job string 3 characters offset from the parent job string (i.e. ABC_D_EQ_XXXXX_YYYY_PRD_UX 05/08/2009 05:47 05/08/2009 05:50 IN 13412850/0 available in job_tree.lst)
The command I am using in shell script to carry out the above task is as below

grep $parent job_tree.lst | tail -1 |sed -e 's*'${parent_job_rep}'*'' '${child_job_rep}'*'

but it's producing an error “SED command: Command Garbled error”

Pl see the test below what I have done in the command prompt

$ cat job_tree.lst
ABC_D_EQ_XXXXX_YYYY_PRD_UX 05/08/2009 05:47 05/08/2009 05:50 IN 13412850/0

$ echo $parent
ABC_D_EQ_XXXXX_YYYY_PRD_UX

$ echo $child_job_rep
XYZ_D_EQ_XXXXX_YYYY_PRD_UX 05/08/2009 05:47 05/08/2009 05:50 IN 13412850/0

$ echo $parent_job_rep
ABC_D_EQ_XXXXX_YYYY_PRD_UX 05/08/2009 05:47 05/08/2009 05:50 IN 13412850/0

$ grep $parent job_tree.lst | tail -1 |sed -e 's*'${parent_job_rep}'*'' '${child_job_rep}'*'
sed: command garbled: s*ABC_D_EQ_XXXXX_YYYY_PRD_UX

But when I give literals in place of substitution variables , it's working see below

$ grep $parent job_tree.lst | tail -1 |sed -e 's*ABC_D_EQ_XXXXX_YYYY_PRD_UX 05/08/2009 05:47 05/08/2009 05:50 IN 13412850/0* XYZ_D_EQ_XXXXX_YYYY_PRD_UX 05/08/2009 05:47 05/08/2009 05:50 IN 13412850/0*'
XYZ_D_EQ_XXXXX_YYYY_PRD_UX 05/08/2009 05:47 05/08/2009 05:50 IN 13412850/0

Can the experts help?

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Garbled Sed w/variables

I'm trying to get a partial file path by passing the part I want removed to sed. Sed gets garbled when I try multiple directories (i.e. because of the extra slash). For example: FULLFILEPATH="usr/local/bin" STRIPDIR="usr" PARTFILEPATH=`echo $FULLFILEPATH | sed s/\${STRIPDIR}//` Gives me... (3 Replies)
Discussion started by: bergerj3
3 Replies

2. Shell Programming and Scripting

sed: command garbled

Im getting this error message when trying to substitute filepaths in a sed search and replace string #!/usr/bin/ksh ORACLE_SID=PH3 ORACLE_ADMIN=/data01/app/oracle/admin/$ORACLE_SID DATAFILE_DIR=/asterisk/oradata/$ORACLE_SID sed -e s/DBNAME/$ORACLE_SID/g < initPH2.ora | sed -e... (1 Reply)
Discussion started by: blakmk
1 Replies

3. Shell Programming and Scripting

sed: command garbled error.....

Dear friends, please give me the solution to the following query. If a file contains multiple tags of same name, then how to get the required string between the tags, in which the string begins with "W/X" i.e., file1.txt contains following text(please note that all the following tags are in... (1 Reply)
Discussion started by: swamymns
1 Replies

4. Shell Programming and Scripting

Sed: command garbled :s/

Hi, I really need some help, I am using a very basic script to proess a text file. This script has been used many times but all of a sudden all on it's own it's stopped working. The line in the script is: sed 's/ //g' $ORGFILE > $NEWFILE and the error is Sed: command garbled :s/ All... (3 Replies)
Discussion started by: heidi.lightfoot
3 Replies

5. Shell Programming and Scripting

sed: command garbled

Hi, I have a file1 as : A=/home/user B=/home/user1 C=/home/user2 D=/home/aacsms E=/home/user1/temp F=/home/user1/area1 and my script as: a=`cat /home/aacsms7/file1 | grep -i e` b=`user2` sed 's/'$a'/"E=/home/'$b'/temp"/g' < file1 > file2 sed: command garbled:... (3 Replies)
Discussion started by: yesmani
3 Replies

6. Shell Programming and Scripting

sed command garbled error

sed: command garbled: s/ri="*"/ri=" what i did is you can see below sed "s/ri=\"*\"/ri=\"$newri\"/" $2 > output how to solve this (2 Replies)
Discussion started by: pasricha.kunal
2 Replies

7. Shell Programming and Scripting

Sed command garbled question

for j in $(cat ${list_B}) do to_replace_2=$(grep $j ${useralias}_2) sed "s/^${j}/${to_replace_2}/p" ${entries} > ${entries}_2 mv ${entries}_2 ${entries} done Hi, I've the above sed command running in a script. Its basically looping through a file and replacing its beginning of line... (8 Replies)
Discussion started by: Jazmania
8 Replies

8. Shell Programming and Scripting

sed: command garbled error

Hi all, Suppose that I want to update the db.password entry in the below properties file, db.username=admin db.password=qhKkBno2U5GEq5k/dnmGPA== //I want this line to be replaced by: "db.password=abc/123/" db.host=server db.port=22 db.sid=database However when... (2 Replies)
Discussion started by: isaacniu
2 Replies

9. Shell Programming and Scripting

sed help - Command garbled

Hi, First post for a noob so please go easy with me :) I have a XML block that is originally like this: <SETNAME>somecrap/THIS</SETNAME> and I would like it be replaced with, in the original file: <SETNAME>THIS</SETNAME> I tried to use: sed... (4 Replies)
Discussion started by: zhuanyi
4 Replies

10. Shell Programming and Scripting

Command garbled when using sed

Hi everyone, Can anyone help me in question below? I want to cron a job to add partition every month but get the error sed: command garbled: s/YYYYMM/ . > echo $YYYYMON_NEW 201304 > echo $YYYYMON_OLD 201208 > echo $YYYY_MM_NEW 2013-05 This is my base script: ALTER TABLE STS.ADMIN ADD... (1 Reply)
Discussion started by: fenocean
1 Replies
ACTDIAG(1)						      General Commands Manual							ACTDIAG(1)

NAME
actdiag - generate activity-diagram image file from spec-text file. SYNOPSIS
actdiag [options] files DESCRIPTION
This manual page documents briefly the actdiag commands. actdiag is a program that generate activity-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. -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 -s, ----separate Separate diagram images for each group (SVG only) -T TYPE Output diagram as TYPE format SEE ALSO
The programs are documented fully by http://tk0miya.bitbucket.org/actdiag/build/html/index.html AUTHOR
actdiag 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). June 5, 2011 ACTDIAG(1)
All times are GMT -4. The time now is 06:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy