Another shellscript question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Another shellscript question
# 8  
Old 11-29-2005
this is NOT the mapfile sample you gave before.
WHICH one do you need?
# 9  
Old 11-29-2005
sorry, I need it for the last 1 I posted?

thanks.
# 10  
Old 11-29-2005
nawk -F: -v sid="${SID}" -f jig.awk mapfile

jig.awk:
Code:
sid == $1 {
  for(i=2; i <= n; i++)
    printf("cp -rp %s_p /pristine %s/oradata/%s\n", $i, $i, $1)
}


Last edited by vgersh99; 11-29-2005 at 12:50 PM.. Reason: included 'sid == $1'
# 11  
Old 11-29-2005
Quote:
Originally Posted by vgersh99
nawk -F: -v sid="${SID}" -f jig.awk mapfile

jig.awk:
Code:
sid == $1 {
  for(i=2; i <= n; i++)
    printf("cp -rp %s_p /pristine %s/oradata/%s\n", $i, $i, $1)
}


not getting anything back..
jbld@tabloo:/home/oracle/scripts/a> awk -F: -v sid="${SID}" -f jig.awk mapfile
jbld@tabloo:/home/oracle/scripts/a>
jbld@tabloo:/home/oracle/scripts/a> export SID=test
jbld@tabloo:/home/oracle/scripts/a> awk -F: -v sid="${SID}" -f jig.awk mapfile

jbld@tabloo:/home/oracle/scripts/a> cat mapfile
test:/u09:/u10
dev:/u01:/u02

jbld@tabloo:/home/oracle/scripts/a> cat jig.awk
sid == $1 {
for(i=2; i <= n; i++)
printf("cp -rp %s_p /pristine %s/oradata/%s\n", $i, $i, $1)
}
# 12  
Old 11-29-2005
I'm sorry - I'm bad - use 'nawk' instead of 'awk':
Code:
sid == $1 {
  for(i=2; i <= NF; i++)
    printf("cp -rp %s_p /pristine %s/oradata/%s\n", $i, $i, $1)
}

# 13  
Old 11-29-2005
We dont have nawk in HPUX unless I dont know the path.... We have awk though..pls help....

Last edited by jigarlakhani; 11-29-2005 at 01:26 PM..
# 14  
Old 11-29-2005
Quote:
Originally Posted by jigarlakhani
We dont have nawk in HPUX unless I dont know the path.... We have awk though..pls help....
ok, try it with awk as is.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk in shellscript

Dear Members, I have the following situation I do not understand: I have a large json encoded file which I need to grep and afterwards want to extract specific information. I use this command to to that: cat /tmp/file | awk -F '"fields":' '{print $2}' | awk -F '"description":' '{print $4}'... (6 Replies)
Discussion started by: crumble
6 Replies

2. Shell Programming and Scripting

Help with shellscript

I am new in shell script i want to convert .txt file in the format axsjdijdjjdk to a x s j d i j d j j d k (5 Replies)
Discussion started by: sreejithalokkan
5 Replies

3. Post Here to Contact Site Administrators and Moderators

help with backup shellscript

can any one advice on this.. create archive backup -yyyymmdd.tr.gzin the directory "backup" that includes the following directory " product/dev","product/uat"and product/maintain", yymmdd, stand for current date This archive needs to be perpared at 9PM every day Thanks advance (1 Reply)
Discussion started by: ksakil
1 Replies

4. UNIX for Dummies Questions & Answers

How can I do aliasing in shellscript?

#Example.sh alias rmv 'sh Example2.sh' when i execute exapme.sh alias name not working. how i solve this problem?? (9 Replies)
Discussion started by: arun508.gatike
9 Replies

5. AIX

ShellScript displays un necessary question marks

Hi, This is suman. I am very new to Shell Scripting. I have a shell script, when I run that script, it is displaying un necessary question marks. But in the scritpt, there is no any " echo ? " statement. Can anybody please help me what could be the cause for displaying question marks ?? ... (3 Replies)
Discussion started by: clnsharma123
3 Replies

6. Shell Programming and Scripting

Need help with shellscript

Hello. I am a novince at writing shell scripts but here is the question. I have to write a shell script that does the following: Once executed via crontab, the script should do the following: a. get date/time stamp in for format 10-MAR-05 and b. execute shell script my_script.sh (which... (2 Replies)
Discussion started by: jigarlakhani
2 Replies

7. UNIX for Advanced & Expert Users

shellscript problem

hI, Pls consider the following shell script #!/bin/csh -f sqlplus tkyte/tkyte <<"EOF" > tmp.csh set serveroutput on declare a number:=5; begin dbms_output.put_line( 'a:='||a ); end; / spool off "EOF" The above script does the followin 1)it connects... (1 Reply)
Discussion started by: ravi raj kumar
1 Replies

8. UNIX for Advanced & Expert Users

ftp in Shellscript

Can I do something like this from a shellscript ?: ftp 12.34.56.78 <<! username password put a.c bye ! It does not go through as the login fails. Is there any alternative to do the above requirement? Thanks in advance. Gowrish (3 Replies)
Discussion started by: ggowrish
3 Replies
Login or Register to Ask a Question