Another shellscript question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Another shellscript question
# 15  
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)
}

Question; how can Incorporate this whole thing in 1 script? assuming the mapfile is an external file.
# 16  
Old 11-29-2005
Quote:
Originally Posted by jigarlakhani
Question; how can Incorporate this whole thing in 1 script? assuming the mapfile is an external file.
you really need to start reading the man pages......

Code:
nawk -F: -v sid="${SID}" '
  sid == $1 {
    for(i=2; i <= NF; i++)
      printf("cp -rp %s_p /pristine %s/oradata/%s\n", $i, $i, $1)
  }' mapfile

# 17  
Old 11-29-2005
Data

1 last request pls..I promose to take some scripting classes..I am a dba by profession not a shellscripting expert like you guys are....
Code:
 
> cat newmaptest 

  this is source      this is destination 
/s01/oradata/jbld:/u01/oradata/test 
/s02/oradata/jbld:/u02/oradata/test

how can i get the following command
cp -rp /s01/oradata/jbld /u01/oradata/test
cp -rp /s02/oradata/jbld /u02/oradata/test


thanks a lot
# 18  
Old 11-30-2005
Code:
> cat newmaptest 
/s01/oradata/jbld:/u01/oradata/test 
/s02/oradata/jbld:/u02/oradata/test

Code:
> sed -e 's/^/cp -rp /g;s/:/ /' newmaptest
cp -rp /s01/oradata/jbld /u01/oradata/test
cp -rp /s02/oradata/jbld /u02/oradata/test

# 19  
Old 11-30-2005
Thanks Matrix Madhan and vgersh99. That really helped.

-Jigar
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