05-30-2009
scripting help with bash and awk
I'm trying to reformat some tide information into a useable format and failing.
Input file is....
4452 CHENNAI (MADRAS)
13°06'N, 80°18'E India East Coast 01 June 2009 UT(GMT)
Data Area 3. Indian Ocean (northern part) and Red Sea to Singapore
01/06/2009
00:00 0.7 m
00:20 0.7 m
00:40 0.7 m
01:00 0.6 m
01:20 0.6 m
01:40 0.6 m
02:00 0.5 m
02:20 0.5 m
etc
22:00 0.9 m
22:20 0.9 m
22:40 0.9 m
23:00 0.9 m
23:20 0.9 m
23:40 0.9 m
02/06/2009
00:00 0.9 m
00:20 0.8 m
00:40 0.8 m
01:00 0.8 m
01:20 0.8 m
01:40 0.7 m
etc
22:20 0.9 m
22:40 0.9 m
23:00 0.9 m
23:20 0.9 m
23:40 1.0 m
03/06/2009
00:00 1.0 m
00:20 1.0 m
00:40 0.9 m
01:00 0.9 m
01:20 0.9 m
01:40 0.9 m
etc
22:20 0.8 m
22:40 0.8 m
23:00 0.9 m
23:20 0.9 m
23:40 1.0 m
Predicted heights are in metres above Chart Datum
Printed by TotalTide
etc just means that I have taken out values for display purposes, time increment by 20 minutes all day.
The output file I want is three columns; julian day, 24hr time and tide correction as below..
key key
day hourmin tide
152 0000 0.7
152 0020 0.7
152 0040 0.7
152 0100 0.6
152 0120 0.6
152 0140 0.6
152 0200 0.5
152 0220 0.5
etc
152 2200 0.9
152 2220 0.9
152 2240 0.9
152 2300 0.9
152 2320 0.9
152 2340 0.9
153 0000 0.9
153 0000 0.8
153 0040 0.8
153 0100 0.8
153 0120 0.8
153 0140 0.7
etc
153 2220 0.9
153 2240 0.9
153 2300 0.9
153 2320 0.9
153 2340 1.0
154 0000 1.0
154 0020 1.0
154 0040 0.9
154 0100 0.9
154 0120 0.9
154 0140 0.9
etc
154 2220 0.8
154 2240 0.8
154 2300 0.9
154 2320 0.9
154 2340 1.0
Thank you in advance people
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need some help making this script... I guess I'm having trouble even interpretating what to even get started on...
I need to create a script that will search a given directory (typically a user's home directory, but not necessarily) as provided on the command line and any sub-directors for... (2 Replies)
Discussion started by: Jukai
2 Replies
2. Shell Programming and Scripting
hi all
i'm trying to get a script working upon connection with pppd
According to docu this happens ina clean environment with a couple of variables set, namely $1,$2,...
To be able to execute the statements i included a path statement but i think i'm running into trouble with the variables -... (6 Replies)
Discussion started by: jimjones
6 Replies
3. Shell Programming and Scripting
Hi,
can anyone help me with my scrip please. I wanted do following tasks:
1. List all the directory
2. A STDIN to ask user to enter a directory name from listed directories
3. command to check if the directory exists( or a command to validate if the user entered a valid directory name)... (3 Replies)
Discussion started by: eminjan
3 Replies
4. Shell Programming and Scripting
Hi,
can anyone help me with my scrip please. I wanted do following tasks:
1. List all the directory
2. A STDIN to ask user to enter a directory name from listed directories
3. command to check if the directory exists( or a command to validate if the user entered a valid directory name)
... (2 Replies)
Discussion started by: eminjan
2 Replies
5. Shell Programming and Scripting
Hey guys, i am fairly new to scripting and I am trying to write a script that takes a comma delimited file as input. I am trying to figure out a way to determine if $1 and $3 exist on a line (basically a hostname and ip address) and if true do the following,
resolve the hostname to ip.
sample... (6 Replies)
Discussion started by: streetfighter2
6 Replies
6. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
i have to do this but i am confused,
Create a file containing the bash functions which perform the... (1 Reply)
Discussion started by: CRAZYLITTLELOU
1 Replies
7. Shell Programming and Scripting
have this code but when i run it i get this error
./pulse: line 2: and here is the code
#!/bin/bash
if ;
then
pulseaudio -k;
fi
what am i doing wrong
thanks
Adam (5 Replies)
Discussion started by: ab52
5 Replies
8. Shell Programming and Scripting
Try to imagine a flag:
nnnnx
nnnxx
nnxxx
nxxxx
now imagine how it will output:
4 times the "n"and 1 times "x"
3 times "n"and" 2 times" x "
.. etc. ..
rhombus is the same only instead of "n" is there
gap "and " x "is a few times to form the correct shape
Can you help... (3 Replies)
Discussion started by: krcek12
3 Replies
9. Shell Programming and Scripting
Hi Guys i have a <script?> that spits out the location of each printer using snpget
here is the code
for i in `sed -n '/Start Printer/,/End Printer/p' /hosts/blah/etc/dhcp/hosts.conf | awk '!/^#/ {print $2}' | egrep -v \... (2 Replies)
Discussion started by: ab52
2 Replies
10. Shell Programming and Scripting
same script:
1- i am using grep to find a string called: tinker panic 0 in a file /etc/ntp.conf
if the string is not there, i want to add the strings in /etc/ntp.conf file in the first line of the file. if not do nothing or exit.
2- also i want to add # in front of the following lines in... (0 Replies)
Discussion started by: lamoul
0 Replies