The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cut the last field 435 Gavea Shell Programming and Scripting 9 03-17-2009 01:04 PM
Cut last Field sfaqih Shell Programming and Scripting 2 11-12-2008 04:46 AM
Retrieve 5th Field to Last Field !! jobbyjoseph UNIX for Dummies Questions & Answers 3 05-16-2007 04:20 AM
Moving Part of a field to another field using AWK rjsha1 Shell Programming and Scripting 5 08-04-2006 06:39 AM
add increment field when first field changes azekry Shell Programming and Scripting 2 11-14-2005 04:21 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-30-2009
HernandJ2 HernandJ2 is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 5
Awk and sql field comparation help.

Hi, before my question let me excuse myself for the bad grammar and possible confusion (i am used to write in spanish)*

I need some help, i'm making a query:

SELECT empnmbr as empl, origin as addr, old_fields_value as prev_sta, new_fields_value as new_sta \
FROM webapplog$bdate, datachangelog$bdate \
WHERE datachangelog$bdate.webapplog_oid = webapplog$bdate.oid \
AND datachangelog$bdate.table_name = 'address'
ORDER BY WEBAPPLOG_OID


which returns answers like:

empl | addr | prev_sta | new_sta
23424|3030303| 17,1,2,3,4,5,6,7,8|17,2,2,3,4,5,6,7,9
12345|home ad| 18,1,5,1,6,1,16,15|18,2,4,1,6,1,16,19


What i need is to read every line of the answer, compare the differences between the third and fourth fields for every line, and mark in which position of those fields are the differences.

so the answer will be more like:

empl | addr | prev_sta | new_sta | position
23424|3030303| 1 |2 | 2
23424|3030303| 8 |9 | 9
12345|home ad| 1 |2 | 2
12345|home ad| 5 |4 | 3
12345|home ad| 15 |19 | 8

but i have no idea what to do here. Maybe passing each field to an array and comparing arrays? the third and fourth fields of the original query have always the same number of elements (25) but sometimes only a single element is different.

Please any hint is helpful




*Si a alguno de los miembros del foro le parece mas simple puedo escribir en espanol y quiza sea mas claro el caso
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0