Script help: sliding time windows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script help: sliding time windows
# 1  
Old 02-19-2010
Script help: sliding time windows

I have a script like this ...

Code:
#!/bin/ksh
database=$(echo $@ | sed 's/.*-S \([a-zA-Z0-9]*\).*/\1/')
instance=$(grep $database /var/opt/oracle/oratab | awk -F : '{print $1}')
command=$(echo $@ | sed "s/$database/$instance/")
echo  $command


if I execute this script in ksh or bash it works fine .

when I tried to execute this from another system I am getting this error . Didn't understand why it's failing....

HTML Code:
grep: invalid option -- S
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
sed: -e expression #1, char 8: unknown option to `s'

Thanks
# 2  
Old 02-19-2010
Try this
Code:
grep "$database" /var/opt/oracle/oratab

Code:
sed 's/'"$database"'/'"$instance"'/'

# 3  
Old 02-19-2010
Please post an example of how the script is called.
# 4  
Old 02-19-2010
Thankyou !!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search and replace with a sliding window

Hi Unix Gurus, I have a file with data like: >header_1 TCCCCGA >header_2 CCAATTGGGTA The data to work with starts from the next line after '>header_xx'. (1) I want to search the three letter patterns 'CHH' or 'DDG' and replace C and G by exclamation ! so that CHH becomes !HH and DDG... (3 Replies)
Discussion started by: Fahmida
3 Replies

2. Shell Programming and Scripting

How do add values in a vector using a sliding window?

Greetings. I have a vector of numbers such as the following: 1 75 79 90 91 92 109 120 167 198 203 204 206 224 230 236 240 (4 Replies)
Discussion started by: Twinklefingers
4 Replies

3. Shell Programming and Scripting

Calculating time windows from logfile timestamps

Hey all. I am working on some scripts in bash to perform a variety of functions; there are a variety of steps involved, and they must happen in a specific sequence; what I need help with is a way to calculate some differences in a timestamp in a logfile. One of the steps in the scripts I am... (3 Replies)
Discussion started by: danowar
3 Replies

4. Shell Programming and Scripting

Sliding window for string manipulation

I have a sting of "0"s and "1"s that I need to analyze. I need to look at each "1" and determine if it is in a neighborhood that is enriched for "1"s which means it is one of at least three "1"s in a 4 character window. My desired output is a count of "1"s in an enriched area. For Example Input... (1 Reply)
Discussion started by: monstrousturtle
1 Replies

5. Shell Programming and Scripting

Shell script to convert epoch time to real time

Dear experts, I have an epoch time input file such as : - 1302451209564 1302483698948 1302485231072 1302490805383 1302519244700 1302492787481 1302505299145 1302506557022 1302532112140 1302501033105 1302511536485 1302512669550 I need the epoch time above to be converted into real... (4 Replies)
Discussion started by: aismann
4 Replies

6. UNIX for Dummies Questions & Answers

Sliding window

Very simple problem I am not able to solve. I have been trying to modify the following code: awk '{t=$1; c = x}{for (i = 1; i <= length; i += wn)print t FS"" substr($2, i, mx) > ("block" ++c)}' mx=100 wn=100 infile.txt What I am tryng to acccomplish, I have a bunch of files where the first... (3 Replies)
Discussion started by: Xterra
3 Replies

7. Shell Programming and Scripting

Sliding window for sequencing data

Hi! I have some sequencing data that I have aligned using maq software Now, I have data that looks like this each line is a 'tag' chr1 10001 chr1 10002 chr1 10005 chr1 10007 chr1 10008 chr1 10008 chr1 10008 chr1 10019 chr1 10019 chr1 10020 What I really want to find out is how... (1 Reply)
Discussion started by: biobio
1 Replies

8. UNIX for Dummies Questions & Answers

Flipping between Windows 2k and Unix in real time

What's the best way to run two OS's in real time?? I want to run Windows 2k professional and a flavor of UNIX in real time and flip between the two. I have vmware ver. 3.2 and Virtual PC 4.3. I would preferably like to run Win2k with Solaris 8 (intel version) but I'll download Freebsd if... (1 Reply)
Discussion started by: fusion99
1 Replies
Login or Register to Ask a Question