10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have stored a command output in an array like below
@a = `xyz`;
actually xyz comnad will give the output like this
tracker
date
xxxxxxx
xxxxxxx
---------------------
1 a
2 b
----------------------
i have stored the "xyz" output to an... (3 Replies)
Discussion started by: siva kumar
3 Replies
2. Shell Programming and Scripting
Hi
I need to delete lines from a file which are after pattern1 and between pattern 2 and patter3, as below:
aaaaaaaa
bbbbbbbb
pattern1
cdededed
ddededed
pattern2
fefefefe <-----Delete this line
efefefef <-----Delete this line
pattern3
adsffdsd
huaserew
Please can you suggest... (6 Replies)
Discussion started by: vk2012
6 Replies
3. Shell Programming and Scripting
hey guys,
I tried searching but most 'search and replace' questions are related to one liners.
Say I have a file to be replaced that has the following:
$ cat testing.txt
TESTING
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
ENDTESTING
This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies
4. Shell Programming and Scripting
I have an array and two variables as below,
I need to check if $datevar is present in $filename.
If so, i need to replace $filename with the values in the array.
I need the output inside an ARRAY
How can this be done.
Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies
5. Shell Programming and Scripting
Hi,
I have 500 MB of file.
I want to retain first line and last line of the file.
I am unaware of deleting lines from a file in PERL.
How can i do it in PERL?
Regards
VANITHA (3 Replies)
Discussion started by: vanitham
3 Replies
6. Shell Programming and Scripting
Hi,
I have the following lines that I would like to see in an array for easy comparisons and printing:
Example 1:
field1,field2,field3,field4,field5
value1,value2,value3,value4,value5Example 2:
field1,field3,field4,field2,field5,field6,field7... (7 Replies)
Discussion started by: ejdv
7 Replies
7. Shell Programming and Scripting
Hi everyone
I have one question about using array in perl. let say I have several log file in one folder.. example
test1.log
test2.log
test3.log
and the list goes on..
how to make an array for this file? It suppose to detect log file in the current directory and all the log file will... (3 Replies)
Discussion started by: sayachop
3 Replies
8. UNIX for Advanced & Expert Users
Hi All,
I have a very huge file (4GB) which has duplicate lines. I want to delete duplicate lines leaving unique lines. Sort, uniq, awk '!x++' are not working as its running out of buffer space.
I dont know if this works : I want to read each line of the File in a For Loop, and want to... (16 Replies)
Discussion started by: krishnix
16 Replies
9. Shell Programming and Scripting
Hi Everyone,
#!/usr/bin/perl
use strict;
use warnings;
my @test=("a;b;qqq;c;d","a;b;ggg;c;d","a;b;qqq;c;d");
would like to split the @test array into two array:
@test1=(("a;b;qqq;c;d","a;b;qqq;c;d"); and @test2=("a;b;ggg;c;d");
means search for 3rd filed.
Thanks
find the... (0 Replies)
Discussion started by: jimmy_y
0 Replies
10. Shell Programming and Scripting
Probably I am not seeing it or I am not using the "delete" correctly I had the following codes but it does not work for me
#!/bin/perl -w
...
@sysFile1 = (a_b, a_c, a_d);
@sysFile2 = (a_c, a_e, b_f);
foreach $line1 (@sysFile1){
trim(\$line1);
(my $tmp1, my $tmp2) = split/_/,... (6 Replies)
Discussion started by: ahtat99
6 Replies
TAP::Parser::YAMLish::Writer(3pm) User Contributed Perl Documentation TAP::Parser::YAMLish::Writer(3pm)
NAME
TAP::Parser::YAMLish::Writer - Write YAMLish data
VERSION
Version 3.25
SYNOPSIS
use TAP::Parser::YAMLish::Writer;
my $data = {
one => 1,
two => 2,
three => [ 1, 2, 3 ],
};
my $yw = TAP::Parser::YAMLish::Writer->new;
# Write to an array...
$yw->write( $data, @some_array );
# ...an open file handle...
$yw->write( $data, $some_file_handle );
# ...a string ...
$yw->write( $data, $some_string );
# ...or a closure
$yw->write( $data, sub {
my $line = shift;
print "$line
";
} );
DESCRIPTION
Encodes a scalar, hash reference or array reference as YAMLish.
METHODS
Class Methods
"new"
my $writer = TAP::Parser::YAMLish::Writer->new;
The constructor "new" creates and returns an empty "TAP::Parser::YAMLish::Writer" object.
Instance Methods
"write"
$writer->write($obj, $output );
Encode a scalar, hash reference or array reference as YAML.
my $writer = sub {
my $line = shift;
print SOMEFILE "$line
";
};
my $data = {
one => 1,
two => 2,
three => [ 1, 2, 3 ],
};
my $yw = TAP::Parser::YAMLish::Writer->new;
$yw->write( $data, $writer );
The $output argument may be:
o a reference to a scalar to append YAML to
o the handle of an open file
o a reference to an array into which YAML will be pushed
o a code reference
If you supply a code reference the subroutine will be called once for each line of output with the line as its only argument. Passed lines
will have no trailing newline.
AUTHOR
Andy Armstrong, <andy@hexten.net>
SEE ALSO
YAML::Tiny, YAML, YAML::Syck, Config::Tiny, CSS::Tiny, <http://use.perl.org/~Alias/journal/29427>
COPYRIGHT
Copyright 2007-2011 Andy Armstrong.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
perl v5.14.2 2012-06-05 TAP::Parser::YAMLish::Writer(3pm)