![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| update base | mleplawy | Shell Programming and Scripting | 6 | 06-02-2008 10:14 AM |
| Getting data into and out of an OpenOffice.org Base database | iBot | UNIX and Linux RSS News | 0 | 04-23-2008 11:50 AM |
| Update NIS+ data | djunerup | SUN Solaris | 0 | 03-26-2008 07:37 AM |
| Using loop reading a file,retrieving data from data base. | Sonu4lov | Shell Programming and Scripting | 1 | 01-18-2007 11:38 PM |
| data base | arunkumar_mca | High Level Programming | 2 | 12-29-2004 02:56 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
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: Code:
2:Mark:1:2:1 3 5 6 3:Susan:3:4:2 4 3 Code:
1:John:3:1:4 3 2 2:Mark:1:2:1 3 5 6 3:Susan:3:4:2 4 3 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"}'
|
| Forum Sponsor | ||
|
|
|
|||
|
|
|||
| Google The UNIX and Linux Forums |