hi,
I have a 20 line file.
I need a command which will brinf back a specific line based upon the line number I enter.
e.g. the file looks like this and is called file1
jim is a man
john is a woman
james is a man
wendy is a woman
lesley is a woman
i want a command that will... (4 Replies)
Hi
I am using "grep" command to get certain pattern out of the file:
PNUM=34
$ grep -w "#${PNUM}" myfile
#34 * 2297 * 410 * 964 * * 4352
$
Is there a way to retrieve the section of the above output without #34 so the output would look like this:... (3 Replies)
I've been working on a script (/bin/sh) in which I have requested and received help here (in which I am very grateful for!). The client has modified their requirements (a tad), so without messing up the script to much, I come once again for assistance.
Here are the file.dat contents:
ABC1... (4 Replies)
Hello,
I have written a script that removes duplicates within a file and places them in another report.
File:
ABC1 012345 header
ABC2 7890-000
ABC3 012345 Content Header
ABC5 593.0000 587.4800
ABC5 593.5000 587.6580
ABC5 593.5000 587.6580
ABC1 67890 header
ABC2 1234-0001
ABC3... (2 Replies)
I have a list of Servers in no particular order as follows:
virtualMachines="IIBSBS IIBVICDMS01 IIBVICMA01"And I am generating some output from a pre-existing script that gives me the following (this is a sample output selection).
9/17/2010 8:00:05 PM: Normal backup using VDRBACKUPS... (2 Replies)
I need to remove the <BR> from all sections of a page, except what is between a section of text:
#!/bin/sh
sed '
/Testing Considerations/,/<B>PT# - Description:/ ! {
s/<BR>//
}
'
But this isn't working. I'm not using the ! operator correctly, can someone... (2 Replies)
I have searched in a variety of ways in a variety of places but have come up empty.
I would like to prepend a portion of a section header to each following line until the next section header. I have been using sed for most things up until now but I'd go for a solution in just about anything--... (7 Replies)
Hi,
i have a file like this:
...
11111111
22222222
33333333
#
4444444
5555555
6666666
7777777
#
...
i want just print the 2 first line between each section (each section is separated with "#"). so desired output would be like this:
...
11111111
22222222 (3 Replies)
I can obtain information from itdt inventory command however it display as below, I'd like to print each entity on one line but seperated by :
the file is something like and each section ends with Volume Tag
Drive Address 256
Drive State ................... Normal
ASC/ASCQ... (3 Replies)
Hi Gurus,
I have below file which has different sections, need to move the sections to beginning of the each record.
original file
aaa
bbb
ccc
ddd
eee
fff
output file.
aaa
bbb
ccc
ddd
eee
fff (6 Replies)
Discussion started by: green_k
6 Replies
LEARN ABOUT MOJAVE
encode::encoder
Encode::Encoder(3pm) Perl Programmers Reference Guide Encode::Encoder(3pm)NAME
Encode::Encoder -- Object Oriented Encoder
SYNOPSIS
use Encode::Encoder;
# Encode::encode("ISO-8859-1", $data);
Encode::Encoder->new($data)->iso_8859_1; # OOP way
# shortcut
use Encode::Encoder qw(encoder);
encoder($data)->iso_8859_1;
# you can stack them!
encoder($data)->iso_8859_1->base64; # provided base64() is defined
# you can use it as a decoder as well
encoder($base64)->bytes('base64')->latin1;
# stringified
print encoder($data)->utf8->latin1; # prints the string in latin1
# numified
encoder("x{abcd}x{ef}g")->utf8 == 6; # true. bytes::length($data)
ABSTRACT
Encode::Encoder allows you to use Encode in an object-oriented style. This is not only more intuitive than a functional approach, but also
handier when you want to stack encodings. Suppose you want your UTF-8 string converted to Latin1 then Base64: you can simply say
my $base64 = encoder($utf8)->latin1->base64;
instead of
my $latin1 = encode("latin1", $utf8);
my $base64 = encode_base64($utf8);
or the lazier and more convoluted
my $base64 = encode_base64(encode("latin1", $utf8));
Description
Here is how to use this module.
o There are at least two instance variables stored in a hash reference, {data} and {encoding}.
o When there is no method, it takes the method name as the name of the encoding and encodes the instance data with encoding. If
successful, the instance encoding is set accordingly.
o You can retrieve the result via ->data but usually you don't have to because the stringify operator ("") is overridden to do exactly
that.
Predefined Methods
This module predefines the methods below:
$e = Encode::Encoder->new([$data, $encoding]);
returns an encoder object. Its data is initialized with $data if present, and its encoding is set to $encoding if present.
When $encoding is omitted, it defaults to utf8 if $data is already in utf8 or "" (empty string) otherwise.
encoder()
is an alias of Encode::Encoder->new(). This one is exported on demand.
$e->data([$data])
When $data is present, sets the instance data to $data and returns the object itself. Otherwise, the current instance data is
returned.
$e->encoding([$encoding])
When $encoding is present, sets the instance encoding to $encoding and returns the object itself. Otherwise, the current instance
encoding is returned.
$e->bytes([$encoding])
decodes instance data from $encoding, or the instance encoding if omitted. If the conversion is successful, the instance encoding will
be set to "".
The name bytes was deliberately picked to avoid namespace tainting -- this module may be used as a base class so method names that
appear in Encode::Encoding are avoided.
Example: base64 transcoder
This module is designed to work with Encode::Encoding. To make the Base64 transcoder example above really work, you could write a module
like this:
package Encode::Base64;
use base 'Encode::Encoding';
__PACKAGE__->Define('base64');
use MIME::Base64;
sub encode{
my ($obj, $data) = @_;
return encode_base64($data);
}
sub decode{
my ($obj, $data) = @_;
return decode_base64($data);
}
1;
__END__
And your caller module would be something like this:
use Encode::Encoder;
use Encode::Base64;
# now you can really do the following
encoder($data)->iso_8859_1->base64;
encoder($base64)->bytes('base64')->latin1;
Operator Overloading
This module overloads two operators, stringify ("") and numify (0+).
Stringify dumps the data inside the object.
Numify returns the number of bytes in the instance data.
They come in handy when you want to print or find the size of data.
SEE ALSO
Encode, Encode::Encoding
perl v5.18.2 2014-01-06 Encode::Encoder(3pm)