Sponsored Content
Top Forums Shell Programming and Scripting scripting help with bash and awk Post 302321109 by garethsays on Saturday 30th of May 2009 07:02:57 AM
Old 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

bash/awk scripting help (creating OLD new users)

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

bash scripting help

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

bash scripting help!!

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

please help with Bash 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

bash scripting and awk help

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

bash,scripting

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

bash scripting help

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

Bash 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

bash scripting help

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

bash 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
ISALNUM(3)						   BSD Library Functions Manual 						ISALNUM(3)

NAME
isalnum -- alphanumeric character test LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <ctype.h> int isalnum(int c); int isalnum_l(int c, locale_t loc); DESCRIPTION
The isalnum() function tests for any character for which isalpha(3) or isdigit(3) is true. The value of the argument must be representable as an unsigned char or the value of EOF. In the ASCII character set, this includes the following characters (with their numeric values shown in octal): 060 ``0'' 061 ``1'' 062 ``2'' 063 ``3'' 064 ``4'' 065 ``5'' 066 ``6'' 067 ``7'' 070 ``8'' 071 ``9'' 101 ``A'' 102 ``B'' 103 ``C'' 104 ``D'' 105 ``E'' 106 ``F'' 107 ``G'' 110 ``H'' 111 ``I'' 112 ``J'' 113 ``K'' 114 ``L'' 115 ``M'' 116 ``N'' 117 ``O'' 120 ``P'' 121 ``Q'' 122 ``R'' 123 ``S'' 124 ``T'' 125 ``U'' 126 ``V'' 127 ``W'' 130 ``X'' 131 ``Y'' 132 ``Z'' 141 ``a'' 142 ``b'' 143 ``c'' 144 ``d'' 145 ``e'' 146 ``f'' 147 ``g'' 150 ``h'' 151 ``i'' 152 ``j'' 153 ``k'' 154 ``l'' 155 ``m'' 156 ``n'' 157 ``o'' 160 ``p'' 161 ``q'' 162 ``r'' 163 ``s'' 164 ``t'' 165 ``u'' 166 ``v'' 167 ``w'' 170 ``x'' 171 ``y'' 172 ``z'' The isalnum_l() function takes an explicit locale argument, whereas the isalnum() function uses the current global or per-thread locale. RETURN VALUES
The isalnum() function returns zero if the character tests false and returns non-zero if the character tests true. COMPATIBILITY
The 4.4BSD extension of accepting arguments outside of the range of the unsigned char type in locales with large character sets is considered obsolete and may not be supported in future releases. The iswalnum() function should be used instead. SEE ALSO
ctype(3), isalpha(3), isdigit(3), iswalnum(3), xlocale(3), ascii(7) STANDARDS
The isalnum() function conforms to ISO/IEC 9899:1990 (``ISO C90''). The isalnum_l() function conforms to IEEE Std 1003.1-2008 (``POSIX.1''). BSD
July 17, 2005 BSD
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy