Sponsored Content
Full Discussion: data base update
Top Forums Shell Programming and Scripting data base update Post 302201097 by mleplawy on Saturday 31st of May 2008 07:25:29 AM
Old 05-31-2008
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"}'

 

8 More Discussions You Might Find Interesting

1. Programming

data base

Dear sirs, I am new to DataBase in C++,Also here iam using mysql, How can do it nad get the result back from the database and do operation onit. Thanks in advance, arunkumar (2 Replies)
Discussion started by: arunkumar_mca
2 Replies

2. Shell Programming and Scripting

Using loop reading a file,retrieving data from data base.

Hi All, I am having trouble through, I am reading the input from tab delimited file containing several records, e.g. line1 field1 field2 field3 so on.. line2 field1 field2 field3 so on.. .. .. on the basis of certain fields for each record in input file, I have to retrieve... (1 Reply)
Discussion started by: Sonu4lov
1 Replies

3. Shell Programming and Scripting

update base

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: 1:John:3:1:4 3 2 2:Mark:1:2:1 3 3:Susan:3:4: input file: (6 Replies)
Discussion started by: mleplawy
6 Replies

4. Shell Programming and Scripting

Filtering data base on range

Hi All, I have the file in following format. I need to change column 16 and column 17 for those lines which has atleast one numerical digit in column 2 , with the exception on SUPP1 Input file : S00005615|1044|0|0.00|0|0.00| |112|-30|28.1|0|0| |20130331|220.2|2|3|... (2 Replies)
Discussion started by: nua7
2 Replies

5. Shell Programming and Scripting

Change Data base on Column

Base of last two column i want to change may data if Last two Column have A and C then Copy Column $4 to Column $3. Input :- DD142 0_1 DD142_A DD142_B A B DD142 1_1 DD142_B DD142_C B C DD142 2_1 DD142_A DD142_C A C DD142 3_1 DD142_A A DD142 3_2 DD142_A A DD142 4_1 DD142_B B ... (4 Replies)
Discussion started by: pareshkp
4 Replies

6. Shell Programming and Scripting

Combine data from two files base on uniq data

File 1 ID Name Po1 Po2 DD134 DD134_4A_1 NN-1 L_0_1 DD134 DD134_4B_1 NN-2 L_1_1 DD134 DD134_4C_1 NN-3 L_2_1 DD142 DD142_4A_1 NN-1 L_0_1 DD142 DD142_4B_1 NN-2 L_1_1 DD142 DD142_4C_1 NN-3 L_2_1 DD142 DD142_3A_1 NN-41 L_3_1 DD142 DD142_3A_1 NN-42 L_3_2 File 2 ( Combination of... (1 Reply)
Discussion started by: pareshkp
1 Replies

7. Shell Programming and Scripting

Grep Data Base on Column

HI Want to grep data from column header and match with second file. File A.txt 1 2 3 4 5 6 X1 A L D J Q R X2 B M K P w T X3 C S L P e Y X4 R Z M A r U FileB.txt 1 2 3 4 6 7 (3 Replies)
Discussion started by: pareshkp
3 Replies

8. Shell Programming and Scripting

Grep Data Base on Header

HI Guys, File A.txt UID,HD1,HD2,HD3,HD4 1,2,33,44,55 2,10,14,15,16 File B.txt UID HD1 HD4 A.txt B.txt >>>Output.txt UID,HD1,HD4 1,2,55 2,10,16 (11 Replies)
Discussion started by: pareshkp
11 Replies
IO::Async::Protocol(3pm)				User Contributed Perl Documentation				  IO::Async::Protocol(3pm)

NAME
"IO::Async::Protocol" - base class for transport-based protocols DESCRIPTION
This subclass of IO::Async:Notifier provides storage for a IO::Async::Handle object, to act as a transport for some protocol. It contains an instance of the transport object, which it adds as a child notifier, allowing a level of independence from the actual transport being used. For example, a stream may actually be an IO::Async::SSLStream to allow the protocol to be used over SSL. This class is not intended to be used directly, instead, see one of the subclasses IO::Async::Protocol::Stream - base class for stream-based protocols EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters: on_closed Optional. Invoked when the transport handle becomes closed. PARAMETERS
The following named parameters may be passed to "new" or "configure": transport => IO::Async::Handle The "IO::Async::Handle" to delegate communications to. on_closed => CODE CODE reference for the "on_closed" event. When a new "transport" object is given, it will be configured by calling the "setup_transport" method, then added as a child notifier. If a different transport object was already configured, this will first be removed and deconfigured using the "teardown_transport". METHODS
$transport = $protocol->transport Returns the stored transport object $protocol->connect( %args ) Sets up a connection to a peer, and configures the underlying "transport" for the Protocol. Takes the following named arguments: socktype => STRING or INT Required. Identifies the socket type, and the type of continuation that will be used. If this value is "stream" or "SOCK_STREAM" then "on_stream" continuation will be used; otherwise "on_socket" will be used. on_connected => CODE Optional. If supplied, will be invoked once the connection has been established. $on_connected->( $protocol ) transport => IO::Async::Handle Optional. If this is provided, it will immediately be configured as the transport (by calling "configure"), and the "on_connected" callback will be invoked. This is provided as a convenient shortcut. Other arguments will be passed to the underlying "IO::Async::Loop" "connect" call. TRANSPORT DELEGATION
The following methods are delegated to the transport object close SUBCLASS METHODS
"IO::Async::Protocol" is a base class provided so that specific subclasses of it provide more specific behaviour. The base class provides a number of methods that subclasses may wish to override. If a subclass implements any of these, be sure to invoke the superclass method at some point within the code. $protocol->setup_transport( $transport ) Called by "configure" when a new "transport" object is given, this method should perform whatever setup is required to wire the new transport object into the protocol object; typically by setting up event handlers. $protocol->teardown_transport( $transport ) The reverse of "setup_transport"; called by "configure" when a previously set-up transport object is about to be replaced. AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-10-24 IO::Async::Protocol(3pm)
All times are GMT -4. The time now is 05:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy