Sponsored Content
Full Discussion: Need help in scripting...
Top Forums Shell Programming and Scripting Need help in scripting... Post 302565456 by anuajay1988 on Tuesday 18th of October 2011 01:50:13 AM
Old 10-18-2011
Need help in scripting...

hi friends.... thanx for you earlier support....
i need one more help from u guys...

I have a text file containing some data...

Code:
201110180036 METAR PABL 180036Z AUTO 13005KT 10SM SCT037 BKN045 OVC055 01/M02 A2986 RMK AO1 PNO=
201110172350 METAR ENSB 172350Z 12010KT 9999 FEW030 M010/M12 Q1008 RMK WIND 1400FT 10008KT=
201110172350 METAR ENAN 172350Z 17006KT CAVOK 06/04 Q0996=
201110172350 METAR ENDU 172350Z 00000KT 9999 FEW035 SCT090 BKN200 02/02 Q0997=
201110180050 METAR ENTC 180050Z 04006KT 9999 NSC 06/04 Q0997=
201110180020 METAR ENAT 180020Z AUTO 11004KT 9999NDV BKN062/// 02/01 Q1000 RMK WIND 700FT 16004KT=
201110172350 METAR ENHF 172350Z VRB02KT 9999 BKN030 05/02 Q0999 RMK WIND 1254FT 21008KT=
201110172350 METAR ENNA 172350Z 18002KT CAVOK 03/02 Q1000 RMK WIND AT 1800FT 230013T=
201110172350 METAR ENKR 172350Z AUTO VRB01KT 9999NDV NCD 03/02 Q1001 RMK WIND 775FT 24010KT=
201110172350 METAR ENBN 172350Z 13011KT CAVOK 10/03 Q0994=
201110172350 METAR ENBO 172350Z 10010KT CAVOK 07/05 Q0995=
201110180020 METAR ENEV 180020Z AUTO 17003KT 9999NDV UP OVC040/// 07/03 Q0996 RMK WIND 1400FT /////KT=
201110180020 METAR ENAL 180020Z AUTO 04015KT 9999NDV NCD 09/06 Q0982=
201110180020 METAR ENKB 180020Z AUTO 11007KT 060V150 9999NDV NCD 09/03 Q0984=
201110172350 METAR ENOL 172350Z 13015KT 9999 FEW040 BKN100 11/03 Q0988=
201110180050 METAR ENVA 180050Z 15014G24KT 110V190 CAVOK 11/02 Q0990 RMK WIND 670FT 16026KT=


I want to make a script which reads the above said file line by line and word by word and compare each word of a line with a definite expression( which i will tell u later) and gives the output in another file in the following format:

Code:
<?xml version="1.0"  encoding="ISO-8859-1" ?>
<decoded_metar_reports version="1.0">
<item>
<icao>PABL</icao>
<station_name>Buckland</station_name>
<country>US: Alaska</country>
<location>65.98N  161.15W</location>
<elevation>7</elevation>
<time>10/18/2011 12:36:00 AM</time>
<temperature>1.0</temperature>
<dew_point>-2.0</dew_point>
<rh>80</rh>
<wind>SE (130) at 5</wind>
<visibility>16000</visibility>
<pressure>1011.2</pressure>
<sky_condition>Scattered clouds at 3700ft, Broken clouds at 4500ft, Overcast at 5500ft</sky_condition>
<weather></weather>
<remarks></remarks>
<heat_index>N/A</heat_index>
<wind_chill>-1.9</wind_chill>
<metar>METAR PABL 180036Z AUTO 13005KT 10SM SCT037 BKN045 OVC055 01/M02 A2986 RMK AO1 PNO=</metar>
</item>
</decoded_metar_report>

and decode each line in the above said format...

thanx in advance....

Last edited by zxmaus; 10-18-2011 at 03:17 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. AIX

New to scripting

We have a scripting requirement, Background: On a particular path, we compress a load of log files into tar.gz. This is done on an hourly basis throughout the day and it produces files of the following format, 2005-08-05-00-021031.tar.gz as an example. This is done by a script. We need: ... (2 Replies)
Discussion started by: rajesh_149
2 Replies

2. Shell Programming and Scripting

scripting guru's pls help me with scripting on AIX

can someone pls help me with the script for a files coming from one system to a particular directory and i want to write a script to move those files to another directory on different system by renaming the files... pls someone help me on this... thanking in anticipation.... (1 Reply)
Discussion started by: thatiprashant
1 Replies

3. 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

4. UNIX for Advanced & Expert Users

Need help on scripting

in unix bc command is used as calculator and also for conversion, i want to convert 5f to decimal. but bc dont consider 5f as hex value it considers 5F as hex value. I get 5f from other iteration so i cant change that f to F...is there any way to convert 5f to decimal ot 5f to 5F :rolleyes: (2 Replies)
Discussion started by: abhinandantn
2 Replies

5. UNIX for Dummies Questions & Answers

Scripting Help

Hello all. Like Ive stated before, I am new to world of Unix. I was given the tast to create a script that will concatenate 20 files into one file. I know that the cat command is to be used but I am looking for something to get started on. Again, basically I need to wrtie a script that whill... (3 Replies)
Discussion started by: ndoggy020
3 Replies

6. 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

7. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

8. Android

Android Scripting Environment: Shell Scripting and Android

I just upgraded to Android 2.2 from 2.1. The GPS issue that was troublesome in 2.1 seems to have been fixed. Some of web browsing seems faster, but it could just be my connection is better today ;) Flash works in some browsers but not very good and it is too slow for Flash apps designed for... (0 Replies)
Discussion started by: Neo
0 Replies

9. 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

10. 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
All times are GMT -4. The time now is 07:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy