Compiling to shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Compiling to shell script
# 1  
Old 01-25-2010
Compiling to shell script

I have the following lines of script to run sequentially(i.e one after the other as arranged). how can I compile it to one shell script of the form DATABASE.sh
Code:
awk '$2~/eaw/{BSC=$3}{print BSC,$0}' RXMOP.log | grep GSM | awk '{print $1,$2,$3,$5}'>TX.data
sed 's/RXOTX/RXORX/g' TX.data>RX.data
sed 's/RXOTX/RXOTRX/g' TX.data>TRX.data
awk -F - '{AS=substr($3,3)}{print $1"-"$2,AS}' TX.data | awk '{ST=substr($3,1,6)}{print $1,$2,ST,$4}' | sed 's/RXOTX/RXOCF/g' | sort -u>CF.data
sed 's/RXOCF/RXOTF/g' CF.data>TF.data
sed 's/RXOCF/RXOCON/g' CF.data>CON.data
sed 's/RXOCF/RXOIS/g' CF.data>IS.data
awk '{for(i=0;i<=7;i++){ orig=$2; $2=$2"-"i; print $0; $2= orig;}}' TX.data>TS.data
cat TX.data>>DATABASE.txt
cat RX.data>>DATABASE.txt
cat TRX.data>>DATABASE.txt
cat TS.data>>DATABASE.txt
cat CF.data>>DATABASE.txt
cat TF.data>>DATABASE.txt
cat IS.data>>DATABASE.txt
cat CON.data>>DATABASE.txt

# 2  
Old 01-25-2010
You can put all those line in a file say (DATABASE.sh), should look like

Code:
 
#!/bin/sh
 
awk '$2~/eaw/{BSC=$3}{print BSC,$0}' RXMOP.log | grep GSM | awk '{print $1,$2,$3,$5}'>TX.data
sed 's/RXOTX/RXORX/g' TX.data>RX.data
sed 's/RXOTX/RXOTRX/g' TX.data>TRX.data
awk -F - '{AS=substr($3,3)}{print $1"-"$2,AS}' TX.data | awk '{ST=substr($3,1,6)}{print $1,$2,ST,$4}' | sed 's/RXOTX/RXOCF/g' | sort -u>CF.data
sed 's/RXOCF/RXOTF/g' CF.data>TF.data
sed 's/RXOCF/RXOCON/g' CF.data>CON.data
sed 's/RXOCF/RXOIS/g' CF.data>IS.data
awk '{for(i=0;i<=7;i++){ orig=$2; $2=$2"-"i; print $0; $2= orig;}}' TX.data>TS.data
cat TX.data>>DATABASE.txt
cat RX.data>>DATABASE.txt
cat TRX.data>>DATABASE.txt
cat TS.data>>DATABASE.txt
cat CF.data>>DATABASE.txt
cat TF.data>>DATABASE.txt
cat IS.data>>DATABASE.txt
cat CON.data>>DATABASE.txt

if you get any error for the commands in bold, try putting complete path to the command.
# 3  
Old 01-25-2010
Its not working i have the following error:
Code:
$ ./DATABASE.sh
./DATABASE.sh: line 2: $'\r': command not found
: No such file or directoryata
awk: cmd. line:1: fatal: cannot open file `RXMOP.log' for reading (No such file
or directory)
: No such file or directoryata
: No such file or directorydata
: No such file or directoryata
: No such file or directoryata
sed: couldn't write 30 items to stdout: Bad file descriptor
     15 [main] sed 4768 _cygtls::handle_exceptions: Error while dumping state (p
robably corrupted stack)
: No such file or directoryata
: No such file or directorydata
: No such file or directoryABASE.txt
: No such file or directoryABASE.txt
: No such file or directoryABASE.txt
: No such file or directoryABASE.txt
: No such file or directoryABASE.txt
: No such file or directoryABASE.txt
: No such file or directoryABASE.txt
cat: CON.data: Cannot allocate memory


Last edited by pludi; 01-25-2010 at 09:33 AM.. Reason: code tags, please...
# 4  
Old 01-25-2010
Let me guess: you wrote the file on Windows, and just copied it over without any kind of conversion, right? If so, either
  • run "dos2unix" on the file if available
  • if you've got vim, open the file, enter
    Code:
    :set fileformat=dos

    and save it
  • use the ASCII transfer method of FTP
  • if everything else fails, run
    Code:
    mv DATABASE.sh DATABASE.sh.dos
    cat DATABASE.sh.dos | tr -d '\r' > DATABASE.sh

# 5  
Old 01-25-2010
Thanks! it's working
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compiling and Executing a Java File With a Shell Script

I'm trying to use a shell script to compile and execute a java file. The java classes are using sockets, so there is a client.java file and a server.java file, each with their own shell script. I also want to handle the command line arguments within the shell script, not the java classes. The... (1 Reply)
Discussion started by: britty4
1 Replies

2. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

3. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

4. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

5. Shell Programming and Scripting

Correct shell script to Call One shell script from another shell script

Hi All, I have new for shell scripting. Problem : I have one scrip at serv1 and path of server is /apps/dev/provimage/scripts and script name:extract_ancillary.bat. I need to call this script at server2(my working server) and execute at server2 . Please let me know how to build the... (5 Replies)
Discussion started by: Vineeta Nigam
5 Replies

6. Shell Programming and Scripting

Need Help writing Bulk-Compiling Script

I'm trying to write a script that can compile my students' homework submissions in bulk. My students' c code is buried in a file path that looks like this: ./Homework\ X/Doe, John/Submission\ Attachments Where I'm struggling is determining how to navigate to each of the submission attachment... (11 Replies)
Discussion started by: GingerGiant
11 Replies

7. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

8. Shell Programming and Scripting

Compiling Shell script

I want to compile a shell script so that anyone can run it on any linux platform without being able to view its content. Is there any way to do this? Thanks in advance ---------- Post updated at 12:00 PM ---------- Previous update was at 11:35 AM ---------- shc creates a stripped binary ... (2 Replies)
Discussion started by: proactiveaditya
2 Replies

9. Shell Programming and Scripting

Compiling Shell Scripts

Dear All I want to know if it is possible to compile shell scripts into executables before running them. Regards Chris (3 Replies)
Discussion started by: chriseke
3 Replies

10. Programming

Errors while Compiling a PC script.

Hi all, I have created a post-C (PC) script OrdItmpopulate.pc. When I am compiling this using the “Make” command I am getting the following error. My “make” command looks like this: make -f $ORACLE_HOME/precomp/demo/proc/demo_proc.mk build EXE=OrdItmpopulate8.exe OBJS="OrdItmpopulate8.o"... (1 Reply)
Discussion started by: musavir19
1 Replies
Login or Register to Ask a Question