Visit The New, Modern Unix Linux Community

Full Discussion: Retune my script
Top Forums UNIX for Dummies Questions & Answers Retune my script Post 302845071 by senthil.ak on Tuesday 20th of August 2013 05:52:57 PM
Retune my script

Hi admin,

I have two files which is on row and many columns ( both are identical), I need to add both the files with two columns and many row.

I have opted the solution in the following way.

awk '{ for (i=1;i<=NF;i++) { print $i;}}' tmp1 > tmp
mv tmp tmp1
awk '{ for (i=1;i<=NF;i++) { print $i;}}' tmp2 > tmp
mv tmp tmp2
paste tmp1 tmp2 > final

Sample the input files

$cat tmp1
951  1    0    0    0    0    0    0    29   701  4    0    0    1    0    0    7    4    0    0    0    0    0    0    4    6    0    0    0    0    0    0    0    1
$cat tmp2
915  44   6    0    3    0    0    0    74   1637 24   0    0    0    0    1    40   15   21   8    0    0    0    0    9    59   5    0    0    0    0    0    1    19

The output is

$paste tmp1 tmp2 | head -4
951     915
1       44
0       6
0       0

Could you please tune my script,

Test Your Knowledge in Computers #382
Difficulty: Medium
HP-UX 11i V3 Release B.11.31 is registered as UNIX V7 compliant.
True or False?

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

if statment, based on retune value

hello im working on a project for the iphone to write a termainal based program we have bsd subsystem installed so have access to most unix command i have a executable called coordinates, which get the coordinates of the iphone when this runs it returns to the terminal the text of... (1 Reply)
Discussion started by: toliver182
1 Replies

2. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

3. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "" | grep -v grep) #check is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r / 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

4. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script( from a master script( to get string type value from calling script to master script. I have used scripts mentioned below. ./ echo $fileExist echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

5. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

6. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "" script and a "" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
Alzabo::Runtime::Row(3pm)				User Contributed Perl Documentation				 Alzabo::Runtime::Row(3pm)

Alzabo::Runtime::Row - Row objects SYNOPSIS
use Alzabo::Runtime::Row; my $row = $table->row_by_pk( pk => 1 ); $row->select('foo'); $row->update( bar => 5 ); $row->delete; DESCRIPTION
These objects represent actual rows from the database containing actual data. In general, you will want to use the "Alzabo::Runtime::Ta- ble" object to retrieve rows. The "Alzabo::Runtime::Table" object can return either single rows or row cursors. ROW STATES
Row objects can have a variety of states. Most row objects are "live", which means they represent an actual row object. A row can be changed to the "deleted" state by calling its "delete()" method. This is a row that no longer exists in the database. Most method calls on rows in this state cause an exception. There is also a "potential" state, for objects which do not represent actual database rows. You can call "make_live()" on these rows in order to change their state to "live". Finally, there is an "in cache" state, which is identical to the "live" state, except that it is used for object's that are cached via the "Alzabo::Runtime::UniqueRowCache" class. METHODS
Row objects offer the following methods: select (@list_of_column_names) Returns a list of values matching the specified columns in a list context. In scalar context it returns only a single value (the first column specified). If no columns are specified, it will return the values for all of the columns in the table, in the order that are returned by "Alzabo::Run- time::Table->columns". This method throws an "Alzabo::Runtime::NoSuchRowException" if called on a deleted row. select_hash (@list_of_column_names) Returns a hash of column names to values matching the specified columns. If no columns are specified, it will return the values for all of the columns in the table. This method throws an "Alzabo::Runtime::NoSuchRowException" if called on a deleted row. update (%hash_of_columns_and_values) Given a hash of columns and values, attempts to update the database to and the object to represent these new values. It returns a boolean value indicating whether or not any data was actually modified. This method throws an "Alzabo::Runtime::NoSuchRowException" if called on a deleted row. refresh Refreshes the object against the database. This can be used when you want to ensure that a row object is up to date in regards to the database state. This method throws an "Alzabo::Runtime::NoSuchRowException" if called on a deleted row. delete Deletes the row from the RDBMS and changes the object's state to deleted. For potential rows, this method simply changes the object's state. This method throws an "Alzabo::Runtime::NoSuchRowException" if called on a deleted row. id_as_string Returns the row's id value as a string. This can be passed to the "Alzabo::Runtime::Table->row_by_id" method to recreate the row later. For potential rows, this method always return an empty string. This method throws an "Alzabo::Runtime::NoSuchRowException" if called on a deleted row. is_live Indicates whether or not the given row represents an actual row in the database. is_potential Indicates whether or not the given row represents an actual row in the datatbase. is_deleted Indicates whether or not the given row has been deleted table Returns the "Alzabo::Runtime::Table" object that this row belongs to. schema Returns the "Alzabo::Runtime::Schema" object that this row's table belongs to. This is a shortcut for "$row->table->schema". rows_by_foreign_key This method is used to retrieve row objects from other tables by "following" a relationship between two tables. It takes the following parameters: * foreign_key => "Alzabo::Runtime::ForeignKey" object Given a foreign key object, this method returns either a row object or a row cursor object the row(s) in the table to which the relation- ship exist. The type of object returned is based on the cardinality of the relationship. If the relationship says that there could only be one match- ing row, then a row object is returned, otherwise it returns a cursor. POTENTIAL ROWS
The "potential" row state is used for rows which do not yet exist in the database. These are created via the "Alzabo::Runtime::Ta- ble->potential_row" method. They are useful when you need a placeholder object which you can update and select from, but you don't actually want to commit the data to the database. These objects are not cached. Once "make_live()" is called, the object's state becomes "live". Potential rows have looser constraints for column values than regular rows. When creating a new potential row, it is ok if none of the columns are defined. If a column has a default, and a value for that column is not given, then the default will be used. However, you cannot update a column in a potential row to undef (NULL) if the column is not nullable. No attempt is made to enforce referential integrity constraints on these objects. You cannot set a column's value to a database function like "NOW()", because this requires interaction with the database. make_live This method inserts the row into the database and changes the object's state to "live". This means that all references to the potential row object will now be references to the real object (which is a good thing). This method can take any parameters that can be passed to the "Alzabo::Runtime::Table->insert" method. Any columns already set will be passed to the "insert" method, including primary key values. However, these will be overridden, on a col- umn by column basis, by a "pk" or "values" parameters given to the "(make_live()" method. Calling this method on a row object that is not in the "potential" state will cause an "Alzabo::Runtime::LogicException" AUTHOR
Dave Rolsky, <> perl v5.8.8 2007-12-23 Alzabo::Runtime::Row(3pm)

Featured Tech Videos

All times are GMT -4. The time now is 04:11 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy