09-06-2019
You mean the base64-string is repeated on the next line?
Doesn't make sense, does it? Currently it is ignored. Nothing to be done.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi!,
In my shell scripts, I always create a logfile by adding the following line in the beginning:
exec >file.log 2>&1
This in turn directs all the output to this logfile till the script executes.
But now, I have to write some output to the monitor for the users.
So, i am doing it... (2 Replies)
Discussion started by: jyotipg
2 Replies
2. Shell Programming and Scripting
i want to print the idle time of the users more than 10 days.
for eg:
my "w" command output is like below.
-sh-3.00$ w
03:47:41 up 13 days, 16:59, 3 users, load average: 10.00, 10.00, 10.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root :0 - ... (2 Replies)
Discussion started by: Krrishv
2 Replies
3. Shell Programming and Scripting
Hi,
I wish to format the output of a grep command in such a way that sed will be able to handle the newline characters held in the output.
Since sed does not allow newlines to be contained in a replacement pattern, that means adding a backslash '\' character to the end of each line from... (8 Replies)
Discussion started by: timculhane
8 Replies
4. Shell Programming and Scripting
I want to print/echo an output "This is the name of the game" where each letter will be printed/echoed after an interval of 1 sec (6 Replies)
Discussion started by: proactiveaditya
6 Replies
5. Shell Programming and Scripting
Hi There,
I have a Solaris server that has a bunch of zones configured and I am trying to write a script that will take all interfaces other than the loopback ones (e.g. lo0:3 etc) and present them so that I can easily determine the zone that owns the IP
So in the case of the following... (2 Replies)
Discussion started by: hcclnoodles
2 Replies
6. Shell Programming and Scripting
Hi, I'm fairly new to scripting and Unix. I'm having trouble printing the number of directories and number of files in all the directories in 2 columns using scripts.
#!/bin/bash
echo "# of Directories --------- # of Messages/Files "
numDir= $(find . -type d | wc -l)
numMsg= $(find .... (4 Replies)
Discussion started by: nuclearpenguin
4 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I need help in printing data in below format from file extensions with .dml, i have listed details below
file name is test_temp.dml, location in /home/users/test01/test_temp.dml
file content:
sample_type=
record
decimal(",") test_type;
date("DD-MM-YYYY")(",") test_date... (2 Replies)
Discussion started by: AAHinka
2 Replies
8. Programming
Hi Guys,
I am new to python and I am trying to print ouput of Popen on my text screen (tkinter gui).
I was able to make it work on Linux with this code:
Linux: Working
def PrintSomething2():
outputdata = commands.getstatusoutput("sudo fping -f host.list")
for i in outputdata:... (2 Replies)
Discussion started by: tattoostreet
2 Replies
9. Shell Programming and Scripting
Hi
I have a file profile.txt with the below input:
{"atgUserId":"736f14c4-eda2-4531-9d40-9de4d6d1fb0f","firstName":"donna","lastName":"biehler","email":"schoolathome42@live.com","receiveEmail":"y
es"},
{"atgUserId":"c3716baf-9bf8-42da-8a44-a13fff68d20f","firstName":"Gilberto... (6 Replies)
Discussion started by: ankur328
6 Replies
10. Shell Programming and Scripting
So I am writing a bash script that will search a file line by line for unix timestamps, store all of the timestamps into an array, then check how many of those timestamps were created within the last hour, and finally increment a counter every time it finds a timestamp created within the last hour.... (6 Replies)
Discussion started by: jsikarin
6 Replies
LEARN ABOUT CENTOS
encode::encoder
Encode::Encoder(3) User Contributed Perl Documentation Encode::Encoder(3)
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.16.3 2013-04-29 Encode::Encoder(3)