awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column
Hi,
My input files is like this
Now, these are my following tasks
1. Print a first column for every two rows that has the same value followed by a string.
2. Match on the fourth column for every two rows and if
a. Both values are positive, print another column saying z=0,color=pink for both rows.
b. Both values are negative, print another column saying z=0,color=violet for both rows.
c. If first is positive and second is negative, print another column saying z=0,color=yellow for both rows.
d. If first is negative and second is positive, print another column saying z=0,color=brown for both rows.
So, My final output will be
I was able to print the first column as a series but didn't get to know how to make two values the same and at two row intervals.
hi all:b:,
how to read the column and print the values under that column ...??
file1 have something like this
cat file1
=======
column1, column2,date,column3,column4.....
1, 23 , 12/02/2008,......
2, 45, 14/05/2008,.....
3, 56, 16/03/2008,.....
cat file2
=======... (6 Replies)
I'm having problems since few days ago, and i'm not able to make it works with a simple awk+grep script (or other way to do this).
For example, i have a input file1.txt:
cat inputfile1.txt
218299910417
1172051195
1172070231
1172073514
1183135117
1183135118
1183135119
1281440202
... (3 Replies)
Hi All,
I have a file which is having 3 columns as (string string integer)
a b 1
x y 2
p k 5
y y 4
.....
.....
Question:
I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
Hi. How do I find an expression with awk in only one column, and if it fits, then print that whole column.
1 apple oranges
2 bannanas pears
3 cats dogs
4 hesaid shesaid
echo "which number:"
read NUMBER (user inputs number 2 for this example)
awk " /$NUMBER/ {field to search is field... (2 Replies)
Hi,
I have a file filled with search strings which have a blank in between and look like this:
S. g. Ehr.
o. Jg.
v. d. Chijs
g. Ehr.
Now i would like to search for the strings and it also shall return the next column after the match.
awk -v FILE="search_strings.txt" 'BEGIN {... (10 Replies)
Dear All,
I have a data file input.csv like below. (Only five column shown here for example.)
Data1,StepNo,Data2,Data3,Data4
2,1,3,4,5
3,1,5,6,7
3,2,4,5,6
5,3,5,5,6
From this I want the below output
Data1,StepNo,Data2,Data3,Data4
2,1,3,4,5
3,1,5,6,7
where the second column... (4 Replies)
file1:
file2:
I need to find matches for any lines in file1 that appear in file2. Desired output is '>' plus the file1 term, followed by the line after the match in file2 (so the title is a little misleading):
This is honestly beyond what I can do without spending the whole night on it, so I'm... (2 Replies)
Hi all,
I am new to using awk and am quickly discovering what a powerful pattern-recognition tool it is. However, I have what seems like a fairly basic task that I just can't figure out how to perform in one line. I want awk to find and print all the lines in which one of multiple patterns (e.g.... (8 Replies)
Example:
I have files in below format
file 1:
zxc,133,joe@example.com
cst,222,xyz@example1.com
File 2 Contains:
hxd
hcd
jws
zxc
cst
File 1 has 50000 lines and file 2 has around 30000 lines :
Expected Output has to be :
hxd
hcd
jws (5 Replies)
Discussion started by: TestPractice
5 Replies
LEARN ABOUT DEBIAN
alzabo::column
Alzabo::Column(3pm) User Contributed Perl Documentation Alzabo::Column(3pm)NAME
Alzabo::Column - Column objects
SYNOPSIS
use Alzabo::Column;
foreach my $c ($table->columns)
{
print $c->name;
}
DESCRIPTION
This object represents a column. It holds data specific to a column.
METHODS
table
Returns the table object to which this column belongs.
name
Returns the column's name as a string.
nullable
Returns a boolean value indicating whether or not NULLs are allowed in this column.
attributes
A column's attributes are strings describing the column (for example, valid attributes in MySQL are 'UNSIGNED' or 'ZEROFILL'.
This method returns a list of strings of such strings.
has_attribute
This method can be used to test whether or not a column has a particular attribute. By default, the check is case-insensitive.
It takes the following parameters:
* attribute => $attribute
* case_sensitive => 0 or 1 (defaults to 0)
It returns a boolean value indicating whether or not the column has this particular attribute.
type
Returns the column's type as a string.
sequenced
The meaning of a sequenced column varies from one RDBMS to another. In those with sequences, it means that a sequence is created and that
values for this column will be drawn from it for inserts into this table. In databases without sequences, the nearest analog for a
sequence is used (in MySQL the column is given the AUTO_INCREMENT attribute, in Sybase the identity attribute).
In general, this only has meaning for the primary key column of a table with a single column primary key. Setting the column as sequenced
means its value never has to be provided to when calling "Alzabo::Runtime::Table->insert".
Returns a boolean value indicating whether or not this column is sequenced.
default
Returns the default value of the column as a string, or undef if there is no default.
default_is_raw
Returns true if the default is intended to be provided to the DBMS as-is, without quoting, fore example "NOW()" or "current_timestamp".
length
Returns the length attribute of the column, or undef if there is none.
precision
Returns the precision attribute of the column, or undef if there is none.
is_primary_key
Returns a boolean value indicating whether or not this column is part of its table's primary key.
is_numeric
Returns a boolean value indicating whether the column is a numeric type column.
is_integer
Returns a boolean value indicating whether the column is a numeric type column.
is_floating_point
Returns a boolean value indicating whether the column is a numeric type column.
is_character
Returns a boolean value indicating whether the column is a character type column.
This is true only for any columns which are defined to hold text data, regardless of size.
is_date
Returns a boolean value indicating whether the column is a date type column.
is_datetime
Returns a boolean value indicating whether the column is a datetime type column.
is_time
Returns a boolean value indicating whether the column is a time type column.
is_time_interval
Returns a boolean value indicating whether the column is a time interval type column.
is_blob
Returns a boolean value indicating whether the column is a blob column.
This is true for any columns defined to hold binary data, regardless of size.
generic_type
This methods returns one of the following strings:
integer
floating_point
character
date
datetime
time
blob
unknown
definition
The definition object is very rarely of interest. Use the "type()" method if you are only interested in the column's type.
This methods returns the "Alzabo::ColumnDefinition" object which holds this column's type information.
comment
Returns the comment associated with the column object, if any.
AUTHOR
Dave Rolsky, <autarch@urth.org>
perl v5.8.8 2007-12-23 Alzabo::Column(3pm)