Hi all,
i'm making some test on a data file. Imagine i have two columns inside it :
Just to understand how can it works, imagine to subtract 100 to the number in the first column when the other one in the second column changes by one. For example >> if changes from 20 to 21 then add 100 to 80381, if it changes from 20 to 19 subtract 100 to 80381..that's it.
Any idea it can be done with a shell script while reading a whole file?
Hi! I have a simple question about using a for loop.
I'm trying to open up all the zip files in the currect directory with ark, but I am getting the error "bash: syntax error near unexpected token `for $i ; do ark $i ; done ;
I looked in the info pages for bash, but I can't seem to figure... (2 Replies)
Hi guys, i have been struggling to achieve the following and therefor looking for some help.
I am trying to write something that will summerize the following output from my switches for daily totals.
Basicly if $1 $2 $3 doesnt change, we can keep adding up $4. Probably would use a awk print end... (3 Replies)
hi i am using bash shell to perform some subraction. here is what i have:
i have a while loop and am using i as a counter.
diff= `expr ${ARRAY1} - ${ARRAY2}`
for example array1 has -0.7145 and array2 has -0.7041.
when i try the above command, i get expr: non-numeric argument. any... (6 Replies)
Hello there
Been using Unix bash scripting for two days now so am very new to this. I am currently doing a project now and i'm basically making a noughts and crosses game (or tic tac toe).
I have created the board using an array. When I try and check to see if the array is empty using an If... (3 Replies)
Hi, I am trying to make a script to manage log. I want to write the name of the .gz I moved and the date :
for i in `ls $replog/*.gz`
do
echo " $i "
`echo $i date +%d:%m:%Y`
`echo $datee `>> $replog/mrnet.log
mv $i /var/log/vieux-logs
done
I need to echo... (10 Replies)
Hi All,
I am trying to monitor CPU load of few processes, with the same name.
The output that I get from top is the following
28171 root 20 0 1089m 21m 3608 S 103 0.3 15:16.89 /opt/ppp//h264rtptranscoder.bin --videoPort=14504 --audioPort=14505
27589 root 20 0 1060m 23m... (3 Replies)
Hello everyone,
I need your assistance with bash.
I want to sum up some numbers, that's not the big problem i think, but the values i want to some depending on another number.
For example, I have a file with some rows of content.
Number 1, Number 2, other content.
I want to sum up number... (4 Replies)
Hi everyone, first time visitor to these forums here.
Keeping a long story short I've been attempting to learn how to code in bash. I have VERY little previous experience with coding languages besides simply copying and pasting batch scripts for Windows. So, with that in mind I've followed a... (4 Replies)
Hello, guys !
I need a little help :)
Lets say i have log files with "n" calls like this one :
""""" <+825080825462>","+825080825462","60197774588","from-internal",
"SIP/518-00013e14","SIP/eu.test.com_outgoing-00013e15","Dial",... (4 Replies)
I am sharing a code snippet.
for (( i=0; i<=$(( $count -1 )); i++ ))
do
first=${barr2}
search=${barr1}
echo $first
echo "loop begins"
for (( j=0; j<=5000; j++ ))
do
if } == $search ]]; then
echo $j
break;
fi
done
second=${harr2}
echo $second (2 Replies)
Discussion started by: ngabrani
2 Replies
LEARN ABOUT DEBIAN
dbix::class::filtercolumn
DBIx::Class::FilterColumn(3pm) User Contributed Perl Documentation DBIx::Class::FilterColumn(3pm)NAME
DBIx::Class::FilterColumn - Automatically convert column data
SYNOPSIS
In your Schema or DB class add "FilterColumn" to the top of the component list.
__PACKAGE__->load_components(qw( FilterColumn ... ));
Set up filters for the columns you want to convert.
__PACKAGE__->filter_column( money => {
filter_to_storage => 'to_pennies',
filter_from_storage => 'from_pennies',
});
sub to_pennies { $_[1] * 100 }
sub from_pennies { $_[1] / 100 }
1;
DESCRIPTION
This component is meant to be a more powerful, but less DWIM-y, DBIx::Class::InflateColumn. One of the major issues with said component is
that it only works with references. Generally speaking anything that can be done with DBIx::Class::InflateColumn can be done with this
component.
METHODS
filter_column
__PACKAGE__->filter_column( colname => {
filter_from_storage => 'method'|&coderef,
filter_to_storage => 'method'|&coderef,
})
This is the method that you need to call to set up a filtered column. It takes exactly two arguments; the first being the column name the
second being a hash reference with "filter_from_storage" and "filter_to_storage" set to either a method name or a code reference. In either
case the filter is invoked as:
$row_obj->$filter_specification ($value_to_filter)
with $filter_specification being chosen depending on whether the $value_to_filter is being retrieved from or written to permanent storage.
If a specific directional filter is not specified, the original value will be passed to/from storage unfiltered.
get_filtered_column
$obj->get_filtered_column('colname')
Returns the filtered value of the column
set_filtered_column
$obj->set_filtered_column(colname => 'new_value')
Sets the filtered value of the column
EXAMPLE OF USE
Some databases have restrictions on values that can be passed to boolean columns, and problems can be caused by passing value that perl
considers to be false (such as "undef").
One solution to this is to ensure that the boolean values are set to something that the database can handle - such as numeric zero and one,
using code like this:-
__PACKAGE__->filter_column(
my_boolean_column => {
filter_to_storage => sub { $_[1] ? 1 : 0 },
}
);
In this case the "filter_from_storage" is not required, as just passing the database value through to perl does the right thing.
perl v5.14.2 2010-12-25 DBIx::Class::FilterColumn(3pm)