Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Sed error - multiple number options to `s' command Post 302735449 by Chandru_Raj on Sunday 25th of November 2012 06:06:05 AM
Old 11-25-2012
Lightbulb Still error

Thanks for your reply . After replacing , i am getting new error "no input files"

PFB log

Code:
$ sh script7.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 -i s#"$var2"#"$var3"# < file1
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 -i 's#$$LAST_UPD_DT_TBL1=12/12/2010 12:00:00#$$LAST_UPD_DT_TBL1=31/12/2012 14:00:43#'
sed: no input files
+ 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='$$LAST_UPD_DT_TBL2=01/01/2010 12:00:00'
+ echo '$$LAST_UPD_DT_TBL2=01/01/2010 12:00:00'
$$LAST_UPD_DT_TBL2=01/01/2010 12:00:00
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 -i 's#$$LAST_UPD_DT_TBL2=01/01/2010 12:00:00#$$LAST_UPD_DT_TBL2=23/10/1986 14:23:32#'
sed: no input files
echo "execution completed"
+ echo 'execution completed'
execution completed


Last edited by Scrutinizer; 11-25-2012 at 07:19 AM.. Reason: code tagz
 

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
ZGREP(1)                                                      General Commands Manual                                                     ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 08:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy