Sponsored Content
Full Discussion: Dealing with sum
Top Forums UNIX for Dummies Questions & Answers Dealing with sum Post 302844208 by Scrutinizer on Saturday 17th of August 2013 07:24:24 AM
Old 08-17-2013
What won't work? Please elaborate... What is your OS and version?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help in dealing with arra

I am readinga file lin by line and based craeting a arry of unique elemenst from the second column of the line. However when i coem out of the while loop my array becomes empty , can eny one tell me what I would be doing wrong #!/bin/bash logfile="./mylog.dat" begin=100 end="$(( $begin +... (5 Replies)
Discussion started by: jojan
5 Replies

2. Shell Programming and Scripting

Dealing with log files

Hi , My requirement is that i need to search for a number of strings in a log file and print them with line numbers.The search should be date wise. The sample log file is : Jan 17 02:45:34 srim6165 MQSIv500: (UKBRKR1P_B.LZ_ BENCHMARKS)BIP2648E: Message backed out to a queue; node... (6 Replies)
Discussion started by: charudpss
6 Replies

3. UNIX and Linux Applications

webinject - dealing with popups

Hello We have a webapp that launches a link in a popup. We need to use webinject to check the content of that popup but have been so far unsuccessful. We use webinject as a nagios plugin. Does anyone have any experience of using/configuring webinject and know if this is possible or not? ... (1 Reply)
Discussion started by: skewbie
1 Replies

4. Shell Programming and Scripting

Dealing with files with spaces in the name

Hello, I'm a computer science major and I'm having problems dealing with file names with spaces in them. Particularly I'm saving a file name in a variable and then using the variable in a compare function i.e. a='te xt.txt' b='file2.txt' cmp $a $b If anyone could help me with this particular... (10 Replies)
Discussion started by: jakethegreycat
10 Replies

5. Shell Programming and Scripting

Print sum and relative value of the sum

Hi i data looks like this: student 1 Subject1 45 55 Subject2 44 55 Subject3 33 44 // student 2 Subject1 45 55 Subject2 44 55 Subject3 33 44 i would like to sum $2, $3 (marks) and divide each entry in $2 and $3 with their respective sums and print for each student as $4 and... (2 Replies)
Discussion started by: saint2006
2 Replies

6. Shell Programming and Scripting

cp not dealing with variable properly? please help

I am having trouble with a script that is supposed to : a)take all the jpg pictures in a given directory/parameter and create thumbnails of it in a directory on the desktop. e.g from /here/are/the/files.jpg to ~/Desktop/parser-the/files.png this is my script: all the individual parts... (2 Replies)
Discussion started by: orochinagi
2 Replies

7. Programming

Need help with Card Dealing Program

I'm currently making a card dealing program, it is suppose to display a list of cards like this: "Ace of Heart, is red" "Two of Heart, is red" . . "Ace of Spade, is black" and so on for all suits and numbers. here is my current code: #include <stdio.h> #include <stdlib.h> #include... (3 Replies)
Discussion started by: Izzy123
3 Replies

8. UNIX and Linux Applications

Dealing with geany core

Geany : Home Page, the text editor, sometimes crashes and leaves a geany.core file. This is a binary file and supposedly contains all unsaved work and possibly some other information. Does anyone know how to deal with this file? (2 Replies)
Discussion started by: figaro
2 Replies

9. Slackware

Dealing with lilo and uefi

Recently I have been trying to boot into slackware on a new laptop that came preinstalled with windows 8. I have successfully installed slackware and Lilo, but I have had great difficult attempting to boot into it. Since the laptop contains no optical drive, I have been attempting to boot into... (2 Replies)
Discussion started by: a sandwhich
2 Replies

10. Programming

Dealing with XML comments

I'm writing my own simple XML parser as an experiment. It's a lot more complicated than it's supposed to be. Things supposedly forbidden in XML comments happen all the time in the wild. You're never, ever supposed to find -- inside <!-- xml comments --> but in practice, you don't just find... (2 Replies)
Discussion started by: Corona688
2 Replies
Encode::Guess(3pm)					 Perl Programmers Reference Guide					Encode::Guess(3pm)

NAME
Encode::Guess -- Guesses encoding from data SYNOPSIS
# if you are sure $data won't contain anything bogus use Encode; use Encode::Guess qw/euc-jp shiftjis 7bit-jis/; my $utf8 = decode("Guess", $data); my $data = encode("Guess", $utf8); # this doesn't work! # more elaborate way use Encode::Guess, my $enc = guess_encoding($data, qw/euc-jp shiftjis 7bit-jis/); ref($enc) or die "Can't guess: $enc"; # trap error this way $utf8 = $enc->decode($data); # or $utf8 = decode($enc->name, $data) ABSTRACT
Encode::Guess enables you to guess in what encoding a given data is encoded, or at least tries to. DESCRIPTION
By default, it checks only ascii, utf8 and UTF-16/32 with BOM. use Encode::Guess; # ascii/utf8/BOMed UTF To use it more practically, you have to give the names of encodings to check (suspects as follows). The name of suspects can either be canonical names or aliases. # tries all major Japanese Encodings as well use Encode::Guess qw/euc-jp shiftjis 7bit-jis/; Encode::Guess->set_suspects You can also change the internal suspects list via "set_suspects" method. use Encode::Guess; Encode::Guess->set_suspects(qw/euc-jp shiftjis 7bit-jis/); Encode::Guess->add_suspects Or you can use "add_suspects" method. The difference is that "set_suspects" flushes the current suspects list while "add_suspects" adds. use Encode::Guess; Encode::Guess->add_suspects(qw/euc-jp shiftjis 7bit-jis/); # now the suspects are euc-jp,shiftjis,7bit-jis, AND # euc-kr,euc-cn, and big5-eten Encode::Guess->add_suspects(qw/euc-kr euc-cn big5-eten/); Encode::decode("Guess" ...) When you are content with suspects list, you can now my $utf8 = Encode::decode("Guess", $data); Encode::Guess->guess($data) But it will croak if Encode::Guess fails to eliminate all other suspects but the right one or no suspect was good. So you should instead try this; my $decoder = Encode::Guess->guess($data); On success, $decoder is an object that is documented in Encode::Encoding. So you can now do this; my $utf8 = $decoder->decode($data); On failure, $decoder now contains an error message so the whole thing would be as follows; my $decoder = Encode::Guess->guess($data); die $decoder unless ref($decoder); my $utf8 = $decoder->decode($data); guess_encoding($data, [, list of suspects]) You can also try "guess_encoding" function which is exported by default. It takes $data to check and it also takes the list of sus- pects by option. The optional suspect list is not reflected to the internal suspects list. my $decoder = guess_encoding($data, qw/euc-jp euc-kr euc-cn/); die $decoder unless ref($decoder); my $utf8 = $decoder->decode($data); # check only ascii and utf8 my $decoder = guess_encoding($data); CAVEATS
o Because of the algorithm used, ISO-8859 series and other single-byte encodings do not work well unless either one of ISO-8859 is the only one suspect (besides ascii and utf8). use Encode::Guess; # perhaps ok my $decoder = guess_encoding($data, 'latin1'); # definitely NOT ok my $decoder = guess_encoding($data, qw/latin1 greek/); The reason is that Encode::Guess guesses encoding by trial and error. It first splits $data into lines and tries to decode the line for each suspect. It keeps it going until all but one encoding was eliminated out of suspects list. ISO-8859 series is just too suc- cessful for most cases (because it fills almost all code points in x00-xff). o Do not mix national standard encodings and the corresponding vendor encodings. # a very bad idea my $decoder = guess_encoding($data, qw/shiftjis MacJapanese cp932/); The reason is that vendor encoding is usually a superset of national standard so it becomes too ambiguous for most cases. o On the other hand, mixing various national standard encodings automagically works unless $data is too short to allow for guessing. # This is ok if $data is long enough my $decoder = guess_encoding($data, qw/euc-cn euc-jp shiftjis 7bit-jis euc-kr big5-eten/); o DO NOT PUT TOO MANY SUSPECTS! Don't you try something like this! my $decoder = guess_encoding($data, Encode->encodings(":all")); It is, after all, just a guess. You should alway be explicit when it comes to encodings. But there are some, especially Japanese, envi- ronment that guess-coding is a must. Use this module with care. TO DO
Encode::Guess does not work on EBCDIC platforms. SEE ALSO
Encode, Encode::Encoding perl v5.8.0 2002-06-01 Encode::Guess(3pm)
All times are GMT -4. The time now is 11:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy