Unix, awk to read .ksh feed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unix, awk to read .ksh feed
# 1  
Old 10-27-2011
Unix, awk to read .ksh feed

I need some advice, I have live feed containing xml messages which means there is new messages every minute. I need a script that will run every 2 hours using the current time minus 2 hours ( which I able to do) However I have problem with the date formatting i.e.



One date is 27102011:15:30:00
Second date is 2710201115300


Which means when I try to compare the two dates I can't do so because of the formatting.



The first date is from the xml message which I extract using awk code, is there away to change the date format and compare the two dates.
I store the first date in variable can I store the second date in variable. Is there away to do so?


I execute the file using ./filename.ksh | awk



Is there another way to do so?



Is there a way to read this feed every 2 hours and extract the data for these to hours only?Smilie


Can someone please advice me the best way to do this.
# 2  
Old 10-27-2011
Is this live feed replaced or extended every two hours?
# 3  
Old 10-27-2011
Quote:
One date is 27102011:15:30:00
Second date is 2710201115300

Which means when I try to compare the two dates I can't do so because of the formatting.

The first date is from the xml message which I extract using awk code, is there away to change the date format and compare the two dates.
I store the first date in variable can I store the second date in variable. Is there away to do so?
just remove all non-numeric chars from the first date and compare the dates as integers. Where do you compare the dates? In shell or in awk?
If in awk:
Code:
...
myDateFromXml="27102011:15:30:00"
gsub("[^0-9]", "", myDateFromXml)

# 4  
Old 10-27-2011
Unix, awk to read .ksh feed

This is live feed which runs on the background, meaning it contains the data for the day and I need to run script and will get data from 2 hours minus the current time.

Sorry I am not explaining myself
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Feed python with read line in shell

Hello, I am running under ubuntu 14.04. I have a python file bringing requested data. When I run, it asks me to enter query info. After that, it gives the data if anything matched can be found. What I need to accomplish is, instead of entering the requested data from keyboard, to put all... (11 Replies)
Discussion started by: baris35
11 Replies

2. UNIX for Beginners Questions & Answers

awk Command to add Carriage Return and Line Feed

Hello, Can someone please share a Simple AWK command to append Carriage Return & Line Feed to the end of the file, If the Carriage Return & Line Feed does not exist ! Thanks (16 Replies)
Discussion started by: rosebud123
16 Replies

3. Shell Programming and Scripting

awk for replacing line feed

Hello all, I have data like "1"|"My_name"|"My_Email"|"My_Last"|My_other" "2"|"My_name"|"My_Email"|"My_Last"|My_other" "3"|"My_name"|"My_Email"|" "|My_other" "1"|"My_name"|"My_Email"|"My_Last"|My_other" Need output like "1"|"My_name"|"My_Email"|"My_Last"|My_other"... (10 Replies)
Discussion started by: lokaish23
10 Replies

4. Shell Programming and Scripting

awk remove line feed

Hi, I've this file: 1, 2, 3, 4, 5, 6, I need to remove the line feed LF every 3 row. 1,2,3, 4,5,6, Thanks in advance, Alfredo (5 Replies)
Discussion started by: alfreale
5 Replies

5. Shell Programming and Scripting

Extract URL from RSS Feed in AWK

Hi, I have following data file; <outline title="Matt Cutts" type="rss" version="RSS" xmlUrl="http://www.mattcutts.com/blog/feed/" htmlUrl="http://www.mattcutts.com/blog"/> <outline title="Stone" text="Stone" type="rss" version="RSS" xmlUrl="http://feeds.feedburner.com/STC-Art"... (8 Replies)
Discussion started by: fahdmirza
8 Replies

6. Shell Programming and Scripting

replace last form feed with line feed

Hi I have a file with lots of line feeds and form feeds (page break). Need to replace last occurrence of form feed (created by - echo "\f" ) in the file with line feed. Please advise how can i achieve this. TIA Prvn (5 Replies)
Discussion started by: prvnrk
5 Replies

7. Shell Programming and Scripting

How do I feed numbers from awk(1) to tail(1)?

Hello, I am too daft to remember how to properly feed numbers that I've extracted with awk(1) to tail(1). The actual question is probably a lot more simple than the context, but let me give you the context anyway: I've just received some email that was sent with MS Outlook and arrived in... (8 Replies)
Discussion started by: ropers
8 Replies

8. What is on Your Mind?

Post Your Favorite UNIX/Linux Related RSS Feed Links

Hello, I am planning to revise the RSS News subforum areas, here: News, Links, Events and Announcements - The UNIX Forums ... maybe with a subforum for each OS specific news, like HP-UX, Solaris, RedHat, OSX, etc. RSS subforums.... Please post your favorite OS specific RSS (RSS2) link... (0 Replies)
Discussion started by: Neo
0 Replies

9. Shell Programming and Scripting

AWK : read unix command

Hi, Is there a way to have something working like the read Unix command to stop a awk ask a question and get the result. I've try system("read a") but it does not work. Thanks. Franck. (6 Replies)
Discussion started by: fwirbel
6 Replies

10. UNIX for Advanced & Expert Users

Real Time feed for NASDAQ, Chi. Merc., Dow in Unix

I need to know where I can get real time stock market data "ticker" feed, in Unix, that can be captured for use in my data base. If there is a subscriber service, that's good but, I really am looking for a software program that can interface with the Market in question, via modem and capture... (2 Replies)
Discussion started by: dkcordova
2 Replies
Login or Register to Ask a Question