[Solved] need help in shell scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] need help in shell scripting
# 1  
Old 08-11-2011
[Solved] need help in shell scripting

Hi Friends,

Please help me with the following problem:
I have a text file with the following lines:
Code:
Dated:  8/11/2011              

<br>
Time :    0000              
<br>
==============
<br>
--------------------------------------<br>Data Upload Time =4:51:52 AM<br>--------------------------------------<br>OPMT 05004KT 4000 FU SCT120 30/26 Q0998 NOSIG RH82%=<br>
OPFA 00000KT 5000 FU SKC 28/25 Q0998 RH88%=<br>--------------------------------------<br>Data Upload Time =4:53:38 AM<br>--------------------------------------<br>OPLA 04005KT 4000 FU SCT040 27/24 Q1000 NOSIG R/H 88%=<br>--------------------------------------<br>Data Upload Time =4:54:52 AM<br>--------------------------------------<br>OPQT 13010KT 4000 HZ FEW120 23/15 Q1009 RH 59% =<br>
TAF OPQT 110000Z 1103/1112 31010G20KT 5000 HZ SCT050 SCT120 =<br>--------------------------------------<br>Data Upload Time =4:56:36 AM<br>--------------------------------------<br>B/PUR A/P 05002KT 3000 FU SKC 28/26 Q997 85%=<br>
OPBR 05002KT 5000 SKC 29/26 89%=<br>
OPBW 05002KT 3000 HZ SKC 29/26 85%=<br>
OPJM 05006KT 5000 TSRA FEW030CB SCT040 OVC100 24/23 91s HOURLY RAIN IS 3.4MM=<br>
GUPIS 27002KT CAVOK 20/08 45%=<br>
OPAS 00000KT 8000 SCT040 SCT120 20/09 51%=<br>
OPBJ 13004KT 6000 FEW040 SCT120 31/12 31%=<br>
OPBK 00000KT 6000 TS FEW030CB BKN040 23/22 96%=<br>
OPBKR 00000KT 5000 FU SKC 31/26 Q//// 79%=<br>
OPCL 31504KT 8000 SCT120 31/14 36%=<br>
OPDG 00000KT 6000 FEW100 31/26 Q996 79%=<br>
OPDR 00000KT 6000 SCT035 FEW100 20/19 95%=<br>
OPGP 00000KT CAVOK 23/21 87%=<br>
OPGT 24002KT 3000 SCT040 27/11 Q1003 37%=<br>
OPJG 00000KT CAVOK 29/26 Q997 85%=<br>
OPKL 05002KT 6000 TS FEW030CB SCT040 BKN120 23/22 96%=<br>
OPMA 13008KT 4000 TSRA FEW030CB FEW040 OVC100 24/23 Q1003 96%=<br>
OPME 36006KT 8000 RA TS FEW020CB SCT040 OVC100 17/16 95%=<br>
OPOK 05002KT 6000 SKC 28/26 Q998 88%=<br>
OPPT 00000KT 9999 BKN025 26/19 63%=<br>
OPSD 00000KT 6000 SCT040 18/14 Q1023 78%=<br>
OPSS 00000KT 4000 FEW040 SCT100 25/23 88%=<br>OPSW 00000KT 6000 SKC 27/26 Q998 92%COR=<br>--------------------------------------<br>Data Upload Time =5:02:53 AM<br>--------------------------------------<br>OPMB 36002KT 5000 TSRA FEW030CB SCT040 BKN100 24/24 Q1004 100%=<br>
OPTMG DIR 00000KT 6000 SCT035 SCT100 26/23 88%=<br>
OPJBD 00000KT 6000 SCT120 30/28 89%=<br>
OPHZ 00000KT 6000 FEW040 15/09 66%=<br>
OPNPT 00000KT 6000 28/25 85%=<br>--------------------------------------<br>Data Upload Time =5:21:19 AM<br>--------------------------------------<br>OPRN 09016KT 4000 TS FEW025CB BKN030 BKN100  23/22 1002.4=<br>
RN1.TAF OPRN 110000Z 1103/1112Z 14015KT 5000 HZ SCT030 SCT100 BECMG 1103/1105 04015G25KT=<br>
RN2.2000 TSRA FEW025CB SCT030 SCT100 TEMPO 1109/1112 04015G25KT 4000 HZ FEW030TCU SCT040SCT100=<br>



I need to copy each line to a new file which starts from word OP till it meets '=' in the line.

thanx

Last edited by pludi; 08-11-2011 at 04:26 AM..
# 2  
Old 08-11-2011
Code:
 
nawk -F"=" ' /^OP/ {print $1}' inputfile > outputfile

# 3  
Old 08-11-2011
thanx buddyyyy... it worked..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] Need help understanding ksh scripting.

Can any one please tell me where the error in below script. Output is not as per my requirement. if condition not comparing the result of record count of a file with 1. where is the pbm in my script? Appreciate your help.. #!/bin/ksh #Module- #Summary- To move the file to direcotries if... (9 Replies)
Discussion started by: shivadanam
9 Replies

2. Shell Programming and Scripting

[Solved] Shell scripting

I am new to write scripts. I want help to write a shell script to create 10 users and passwords to users. Can any please help me. (9 Replies)
Discussion started by: DONFOX
9 Replies

3. Shell Programming and Scripting

[SOLVED] Book for shell scripting

I plan to buy a shell scripting book. Please suggest me a best book for shell Scripting. It will be great if the book contains more examples. Regards Kalai ---------- Post updated at 01:24 AM ---------- Previous update was at 01:09 AM ---------- I got the solution in the below post. (0 Replies)
Discussion started by: kalpeer
0 Replies

4. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

5. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

6. Shell Programming and Scripting

(solved) Shell scripting to access SQLPLUS using variable

I have shell script which will try to login to SQL Plus and retrieve some data, based on the outcome i will proceed further Below is the content of the file pebblz02% cat test1.ksh #! /bin/ksh dummyvar=`sqlplus -S csm_admin/csm_admin@SIDNAME <<EOF echo hi; exit; EOF` Error message on... (0 Replies)
Discussion started by: kiranlalka
0 Replies

7. Shell Programming and Scripting

[Solved] help me in this looping in shell scripting

Hi, #!/bin/ksh result='/TIA/app/UniQP/queue/document/CSB' i=0; while ; do i=`expr $i + 1` if ($i -lt 5);then echo "THerrFile_$i.err"; else break; fi done ... (0 Replies)
Discussion started by: sudhir_83k
0 Replies

8. Shell Programming and Scripting

[Solved] Read a line from one string till to another.... Unix scripting..

So i have a file which contains paths to JPG images separated by a space. I have to separate them each path to another file. So, I have to search all strings that start from /home/ and ends with .jpg or .png Then write each one to another file... Can you please help me on doing this???:cool: (11 Replies)
Discussion started by: hakermania
11 Replies

9. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

10. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies
Login or Register to Ask a Question