Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Sed error - multiple number options to `s' command Post 302735479 by Chandru_Raj on Sunday 25th of November 2012 08:31:50 AM
Old 11-25-2012
Not fixed yet

Guys,

I am sorry to say that still its not working for me Smilie, I am getting the error "multiple number options to `s' command " again which i got earlier.

PFB the modified code and log

Code:
set -vx
echo "execution started"
for table_name in `cat filelist.txt`
do
var1=$table_name
echo "$var1"
var2=`grep $var1 file1`
echo "$var2"
var3=`grep $var1 file2`
echo "$var3"
sed 's/'"$var2"'/'"$var3"'/' file1 > file7
cat file7 > file1
rm file7
done
echo "execution completed"
------------------------------------------------------
$ sh script6.sh
echo "execution started"
+ echo 'execution started'
execution started
for table_name in `cat filelist.txt`
do
var1=$table_name
echo "$var1"
var2=`grep $var1 file1`
echo "$var2"
var3=`grep $var1 file2`
echo "$var3"
sed 's/'"$var2"'/'"$var3"'/' file1 > file7
cat file7 > file1
rm file7
done
cat filelist.txt
++ cat filelist.txt
+ for table_name in '`cat filelist.txt`'
+ var1='$$LAST_UPD_DT_TBL1'
+ echo '$$LAST_UPD_DT_TBL1'
$$LAST_UPD_DT_TBL1
grep $var1 file1
++ grep '$$LAST_UPD_DT_TBL1' file1
+ var2='$$LAST_UPD_DT_TBL1=12/12/2010 12:00:00'
+ echo '$$LAST_UPD_DT_TBL1=12/12/2010 12:00:00'
$$LAST_UPD_DT_TBL1=12/12/2010 12:00:00
grep $var1 file2
++ grep '$$LAST_UPD_DT_TBL1' file2
+ var3='$$LAST_UPD_DT_TBL1=31/12/2012 14:00:43'
+ echo '$$LAST_UPD_DT_TBL1=31/12/2012 14:00:43'
$$LAST_UPD_DT_TBL1=31/12/2012 14:00:43
+ sed 's/$$LAST_UPD_DT_TBL1=12/12/2010 12:00:00/$$LAST_UPD_DT_TBL1=31/12/2012 14:00:43/' file1
sed: -e expression #1, char 33: multiple number options to `s' command
+ cat file7
+ rm file7
+ for table_name in '`cat filelist.txt`'
+ var1='$$LAST_UPD_DT_TBL2'
+ echo '$$LAST_UPD_DT_TBL2'
$$LAST_UPD_DT_TBL2
grep $var1 file1
++ grep '$$LAST_UPD_DT_TBL2' file1
+ var2=
+ echo ''
grep $var1 file2
++ grep '$$LAST_UPD_DT_TBL2' file2
+ var3='$$LAST_UPD_DT_TBL2=23/10/1986 14:23:32'
+ echo '$$LAST_UPD_DT_TBL2=23/10/1986 14:23:32'
$$LAST_UPD_DT_TBL2=23/10/1986 14:23:32
+ sed 's//$$LAST_UPD_DT_TBL2=23/10/1986 14:23:32/' file1
sed: -e expression #1, char 28: unknown option to `s'
+ cat file7
+ rm file7
echo "execution completed"
+ echo 'execution completed'
execution completed

Moderator's Comments:
Mod Comment edit by bakunin: PLEASE! You posted 3 times now and three times a moderator had to edit the missing CODE-tags into your posts. Use them yourself, if you don't mind, because we have better things to do than to clean up behind you. Thank you!

Last edited by bakunin; 11-25-2012 at 10:02 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find command to use multiple -exec options

Hello All, Is there a way to make exec do a couple of operations on a single input from find? For example, find . -type d -exec ls -l "{}" ";" I would like to give the result of each "ls -l" in the above to a wc. Is that possible? I want to ls -l | wc -l inside exec. How do I... (1 Reply)
Discussion started by: prasanna1157
1 Replies

2. Shell Programming and Scripting

[Solved] how to create multiple directory in one mkdir command

Hi, Unix Gurus, - I have a simple question, I need create multiple directory. I use mkdir {dir1, dir2, dir3) I got one directory as {dir1, dir2, dir3} I searched @ google, I got answer as above code.:wall::confused: Anybody has any idea Thanks in advance ---------- Post updated... (3 Replies)
Discussion started by: ken002
3 Replies

3. Shell Programming and Scripting

[Solved] My sed command not give me a satisfy result

This is my command echo "Test" | sed -f <(sed -e 's/.*/s,&,gI/' mydic) In mydic file,containing 2 columns delimit by comma (,) a,AlphabetA . . . e,AlphabetE . . s,AlphabetS . t,AlphabetT test,testedd . . zebra,zebraaaa The expect result is testedd (0 Replies)
Discussion started by: Runicer
0 Replies

4. UNIX for Dummies Questions & Answers

[solved]Help with a sed command

So I have a bunch of strings in a file. Example Line ./prcol/trt/conf/conf-app/jobdefinition/trt-pre-extr-trt-step.jdef Intended Result pre-extr-trt-step So far I have parsed it out to the last bit, echo $line | cut -d'/' -f7 | cut -d. -f1Result trt-pre-extr-trt-step So I added a... (2 Replies)
Discussion started by: J-Man
2 Replies

5. Shell Programming and Scripting

[SOLVED] sed command

Help request, I have tsted this line of code for hours. The first line works and the second line returns the message " sed: command garbled.....". This is running on solaris. The "${} variables all have good values when echoed. ## /bin/sed -n '1,25p' ${file} >> ${MailFile} ... (3 Replies)
Discussion started by: millerg225
3 Replies

6. UNIX for Dummies Questions & Answers

UNIX find command - using multiple -name options

Hi all, What am trying do is search for a directory that is owned by cm that only exists in a path that has a particular directory ex: what I'm using now is find . -user cm -name '*.rel' -type d -exec ls -dl {} \; This is giving me stuff like this ./../../foo1/../../*.rel... (2 Replies)
Discussion started by: jtmed
2 Replies

7. Shell Programming and Scripting

Processing Multiple Arguments in Command Line Options

Hi All, I am new to scripting. Could you please assist me . Here is my requirement. I have written a script that has 2 option flags defined. -l) calls some function with the arguments passed in front of -l -r) calls second function with the arguments passed in front of -r *) calls the... (7 Replies)
Discussion started by: Jay Deshpande
7 Replies

8. Shell Programming and Scripting

Multiple search options in find command

Hi, I'd like find multiple file options to fetch different types of files. find /path...// -type f -name "*.log" -o -name "*.req" -o -name "*.txt" -mtime +5 -exec ls -l {} \; Where as in the above command only the last .txt files its retriving but not .log and .req files can body help... (1 Reply)
Discussion started by: Y.balakrishna
1 Replies

9. Shell Programming and Scripting

[Solved] Counting The Number of Lines Between Values with Multiple Variables

Hey everyone, I have a bunch of lines with values in field 4 that I am interested in. If these values are between 1 and 3 I want it to count all these values to all be counted together and then have the computer print out LOW and the number of lines with those values in between 1 and 3,... (2 Replies)
Discussion started by: VagabondGold
2 Replies

10. UNIX for Dummies Questions & Answers

[Solved] sed command help

Hello all. Im trying very hard to figure this out, but Im a newbie. I have a file that looks like this.... 6315551234 NJ224 5162224567 SUFF Im trying to put a command together that will make it into this.... UM,6315551234,,,,,NJ224,0 UM,5162224567,,,,,SUFF,0 Im all over the... (7 Replies)
Discussion started by: jay11789
7 Replies
All times are GMT -4. The time now is 01:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy