New to scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting New to scripts
# 1  
Old 11-07-2008
New to scripts

Hi

I need help in creating a script to do the following:

What I would like to do is have a script that will write the text below but will change the text (highlighted in yellow) by reading an external text file.


~ Activate `main_dlg_cur` `ProCmdModelOpen.file`
~ Select `file_open` `Ph_list.Filelist` \
1 `6154547-110.prt`
~ Activate `file_open` `Ph_list.Filelist` \
1 `6154547-110.prt`
!Command ProCmdModelOpenExe was pushed from the software.
~ Timer `UI Desktop` `UI Desktop` \
`EmbedBrowserTimer`
~ Select `main_dlg_cur` `MenuBar1` \
1 `mb7`
~ Close `main_dlg_cur` `MenuBar1`
~ Activate `main_dlg_cur` `mb9#M#{fix_play`
~ Activate `mapkey_resume` `psh_continue`
~ Activate `main_dlg_cur` `ActionMenuSaveStatus`
!%CILayer status saved for all changed layers.
~ Activate `main_dlg_cur` `ProCmdWinCloseAsyn.file`


Thank you, Matt
# 2  
Old 11-07-2008
Nothing is highlighted

Please note the areas you wish to modify, and how you intend to modify them.

Last edited by joeyg; 11-10-2008 at 12:37 PM..
# 3  
Old 11-07-2008
joeyg,

Sorry about that..

I identified the text in that I wish to change in red.

~ Activate `main_dlg_cur` `ProCmdModelOpen.file`
~ Select `file_open` `Ph_list.Filelist` \
1 `
6154547-110.prt`
~ Activate `file_open` `Ph_list.Filelist` \
1 `
6154547-110.prt`
!Command ProCmdModelOpenExe was pushed from the software.
~ Timer `UI Desktop` `UI Desktop` \
`EmbedBrowserTimer`
~ Select `main_dlg_cur` `MenuBar1` \
1 `mb7`
~ Close `main_dlg_cur` `MenuBar1`
~ Activate `main_dlg_cur` `mb9#M#{fix_play`
~ Activate `mapkey_resume` `psh_continue`
~ Activate `main_dlg_cur` `ActionMenuSaveStatus`
!%CILayer status saved for all changed layers.
~ Activate `main_dlg_cur` `ProCmdWinCloseAsyn.file`


The text above is from Pro/Engineer CAD software trail file. It basically records mouse clicks and user inputs. I can run the trail file within Pro/Engineer and it will perform the commands identified. The text identified in red is a part name.

What I need the script to do is to repeatedly write the text above to a separate file using a loop that at ever cycle of the loop, the script will read an external text file that has a list part names. There are over 200 part names.

So as the script runs the text is written the same with the text in red is being replaced by the list of text within a separate text file.


Hope this explains what I am tring to accomplish.

Matt
# 4  
Old 11-10-2008
Over the weekend I have a better way of explaining what I wish to do.

I need to have the script write to a file a series of text, with one word being changed based on reading an external list of words.

for example i would like to have the script write to a file the following:

"Hi my name is xxx"

Where xxx is a viable that changes by read a line of the external text file. The external text file will be as follows:

john
tom
steve

The script will then write the following:

Hi my name is john
Hi my name is tom
Hi my name is steve

I think that a script should be able to do this.
Any help you be greatly appreciated.

Matt
# 5  
Old 11-10-2008
Hammer & Screwdriver

Is this what you are trying to do?

Code:
> cat file50
Hi, my name is 

> cat file51
Joe
Matt
Linda
Kerrin

> cat proc_50.sh
#! /usr/bin/bash
phrase=$(cat file50)
while read name
  do
  echo $phrase $name
done <file51

> proc_50.sh
Hi, my name is Joe
Hi, my name is Matt
Hi, my name is Linda
Hi, my name is Kerrin

# 6  
Old 11-10-2008
Code:
while read nn
do
sed "s/xxx/$nn/" input_file >tmpfile
mv tmpfile input_file
done <namesfile

warning: there is no error checking and this snippet overwrites the data file each time through the loop, so if the sed fails your data file is borked.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

2. Shell Programming and Scripting

Calling scripts from with scripts

Hi all, I'm wondering if you could give me some advice. I am new to scripting and am getting rather frustrated that i can get my script to call another script if certain criteria is met, via command line, but I cannot get the same script to work thru the cron jobs. My first script monitors... (8 Replies)
Discussion started by: echoes
8 Replies

3. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

4. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

5. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

6. Shell Programming and Scripting

Help with Script using rsh and scripts within scripts

Hi, I've written a script that runs on a Database server. It has to shutdown the Application server, do an Oracle Dump and then restart the Application server. Its been a long time since I wrote any shells scripts. Can you tell me if the scripts that I execute within my script will be executed... (3 Replies)
Discussion started by: brockwile1
3 Replies

7. UNIX for Dummies Questions & Answers

Profile scripts versus rc scripts....

what is the difference between login and profile scripts versus the rc scripts? (1 Reply)
Discussion started by: rookie22
1 Replies

8. Shell Programming and Scripting

Calling expect scripts from other expect scripts

Hi, First, let me explain the issue I am trying to solve. We have a lot of expect scripts with the duplicated send/expect commands. So, I'd like to be able to extract the duplicated code into the common scripts that can be used by other scripts. Below is my test where I am trying to call... (0 Replies)
Discussion started by: seva
0 Replies

9. UNIX for Dummies Questions & Answers

Help with scripts

script that ask for "enter a file name" and removes that file and asks for confirmation before deletion if executed the output might look as enter the filename you intent to deleted remover file? Y file deleterd I knwo the comand I would use find . -name *.* -ok rm {}\; I guess... can... (1 Reply)
Discussion started by: LiTo
1 Replies
Login or Register to Ask a Question