HI guys,
I have created a script to read 1 column in a csv file and then place it in text file.
However, when i checked out the text file, it is not in a column format...
Example:
CSV file contains
name,age
aa,11
bb,22
cc,33
After using awk to get first column
TXT file... (1 Reply)
Hi,
Using rsync, I've sent the output to a text file. This is the text file :
Pls help me on converting this text file to a csv file. Probably a script or sth to convert the text file to a csv file. (3 Replies)
HI All,
I have a text file memory.txt which has following values.
Average: 822387 7346605 89.93 288845 4176593 2044589 51883 2.47 7600
i want to convert this file in csv format and i am using following command to do it.
sed s/_/\./g <... (3 Replies)
Hi,
I have a filename.csv in which there are 3 colums, ie:
Name ; prefixnumber ; number
root ; 020 ; 1234567
user1,2,3 ; 070 ; 7654321
What I want is to merge colum 2 and 3 that it becomes 0201234567 or even better +31201234567 so the country number is used and drop the leading 0.... (9 Replies)
Hello,
I have an output file showing database sizes across the 3 environments that I use (LIVE, TEST & DEVELOPMENT).
I am trying to write a script that lets me know if the size of a db on one environment is different to its corresponding db on the other environments.
Here is an example... (4 Replies)
Hi,
I want to print two columns from a .txt file to a .csv file using awk.
data in text file:
Application
-------------------------------------------------- -----------
OS Related Issues 1
EMEA Solutions ... (8 Replies)
Hi,
I have a xml script, I converted it to .txt with values comma seperated using awk function. But I want the output values should be inside double quotes
My xml script (Workorders.xml) is shown like below:
<?xml version="1.0" encoding="utf-8" ?>
<scbm-extract version="3.3">... (8 Replies)
Hi dears
i have text file like this:
INPUT.txt
001_1_173 j nuh ]az
001_1_174 j ]esma. nuh ]/.xori
.
.
. and have another text
like this
TABLE.txt
j j
nuh word1... (6 Replies)
Discussion started by: alii
6 Replies
LEARN ABOUT DEBIAN
moosex::attributehelpers::methodprovider::list
MooseX::AttributeHelpers::MethodProvider::List(3pm) User Contributed Perl Documentation MooseX::AttributeHelpers::MethodProvider::List(3pm)NAME
MooseX::AttributeHelpers::MethodProvider::List - method generator for MooseX::AttributeHelpers::Collection::List
SYNOPSIS
package Stuff;
use Moose;
use MooseX::AttributeHelpers;
has 'options' => (
metaclass => 'Collection::List',
is => 'rw',
isa => 'ArrayRef[Str]',
default => sub { [] },
auto_deref => 1,
provides => {
elements => 'all_options',
map => 'map_options',
grep => 'filter_options',
find => 'find_option',
first => 'first_option',
last => 'last_option',
get => 'get_option',
join => 'join_options',
count => 'count_options',
empty => 'do_i_have_options',
sort => 'sorted_options',
}
);
no Moose;
1;
DESCRIPTION
This is a role which provides the method generators for MooseX::AttributeHelpers::Collection::List.
METHODS
meta
PROVIDED METHODS
count
Returns the number of elements in the list.
$stuff = Stuff->new;
$stuff->options(["foo", "bar", "baz", "boo"]);
my $count = $stuff->count_options;
print "$count
"; # prints 4
empty
If the list is populated, returns true. Otherwise, returns false.
$stuff->do_i_have_options ? print "Good boy.
" : die "No options!
" ;
find
This method accepts a subroutine reference as its argument. That sub will receive each element of the list in turn. If it returns true
for an element, that element will be returned by the "find" method.
my $found = $stuff->find_option( sub { $_[0] =~ /^b/ } );
print "$found
"; # prints "bar"
grep
This method accepts a subroutine reference as its argument. This method returns every element for which that subroutine reference
returns a true value.
my @found = $stuff->filter_options( sub { $_[0] =~ /^b/ } );
print "@found
"; # prints "bar baz boo"
map This method accepts a subroutine reference as its argument. The subroutine will be executed for each element of the list. It is
expected to return a modified version of that element. The return value of the method is a list of the modified options.
my @mod_options = $stuff->map_options( sub { $_[0] . "-tag" } );
print "@mod_options
"; # prints "foo-tag bar-tag baz-tag boo-tag"
sort
Sorts and returns the elements of the list.
You can provide an optional subroutine reference to sort with (as you can with the core "sort" function). However, instead of using $a
and $b, you will need to use $_[0] and $_[1] instead.
# ascending ASCIIbetical
my @sorted = $stuff->sort_options();
# Descending alphabetical order
my @sorted_options = $stuff->sort_options( sub { lc $_[1] cmp lc $_[0] } );
print "@sorted_options
"; # prints "foo boo baz bar"
elements
Returns all of the elements of the list
my @option = $stuff->all_options;
print "@options
"; # prints "foo bar baz boo"
join
Joins every element of the list using the separator given as argument.
my $joined = $stuff->join_options( ':' );
print "$joined
"; # prints "foo:bar:baz:boo"
get Returns an element of the list by its index.
my $option = $stuff->get_option(1);
print "$option
"; # prints "bar"
first
Returns the first element of the list.
my $first = $stuff->first_option;
print "$first
"; # prints "foo"
last
Returns the last element of the list.
my $last = $stuff->last_option;
print "$last
"; # prints "boo"
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to
cpan-RT.
AUTHOR
Stevan Little <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2007-2009 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2010-01-02 MooseX::AttributeHelpers::MethodProvider::List(3pm)