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
update base mleplawy Shell Programming and Scripting 6 06-02-2008 02:14 PM
Getting data into and out of an OpenOffice.org Base database iBot UNIX and Linux RSS News 0 04-23-2008 03:50 PM
Update NIS+ data djunerup SUN Solaris 0 03-26-2008 11:37 AM
Using loop reading a file,retrieving data from data base. Sonu4lov Shell Programming and Scripting 1 01-19-2007 03:38 AM
data base arunkumar_mca High Level Programming 2 12-29-2004 06:56 PM

Closed Thread
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
  #1 (permalink)  
Old 05-31-2008
mleplawy mleplawy is offline
Registered User
  
 

Join Date: May 2008
Posts: 11
data base update

hello everyone
I need to update data base in file

1-ID
2-Name
3-ID group
4-ID teacher
5-mark list

unique ID is (ID+ID group+ID teacher)
we can append 5 th columns (marks list)

main base file:
Code:

Code:
1:John:3:1:4 3 2
2:Mark:1:2:1 3
3:Susan:3:4:

input file:

Code:
2:Mark:1:2:1 3 5 6
3:Susan:3:4:2 4 3

main base file after update:


Code:
1:John:3:1:4 3 2
2:Mark:1:2:1 3 5 6
3:Susan:3:4:2 4 3

I have a problem with add files to array and with compare student ID

Code:
awk 'BEGIN {x=0}{z=0}{y=0}

{getline base[x++] < "base" }

{getline input[z++] < "input" }
 
END
{for (i in base)
    for(n in input)
	if (base[i]==input[n]) //I now, it's not OK column 1,3,4 must be ==
	    output[y++]=input[n]
	else
	    output[y++]=base[i]
}	

{for (z in output)
print output[z] > "base"}'

  #2 (permalink)  
Old 05-31-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,344
No duplicate or cross-posting, read the rules.

This is a similar post:

update base

Thread closed.
Closed Thread

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 08:04 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