Sponsored Content
Top Forums Programming Help to decode in perl script Post 302345368 by pludi on Wednesday 19th of August 2009 04:36:54 AM
Old 08-19-2009
Just as an idea, in case there isn't already a module on CPAN for this format, I'd convert it to YAML (easy, since it's already structured) and then iterate over the resulting structure.

Code:
# Warning: pseudo-code
foreach $line (<$file>)
    if $line eq '{'
        $indent++
        next
    if $line eq '}'
        $indent--
        next
    $yaml .= $indent.$line

YAML::Parse($yaml)

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Please decode in English

Hello: Can anyone please decode this script in English. I have also made some comments which I know.. The actual script does not have one comment also.. #! /bin/ksh . odbmsprd_env.ksh #setting the env.. echo $0 Started at : `date '+%d-%m-%Y %H:%M:%S'` # what's echo $0 ... (4 Replies)
Discussion started by: ST2000
4 Replies

2. Programming

gunzip and base64 decode a string

I am writing a C program to get messages from a JMS queue into a string variable and then write them to a database. The messages are compressed (gzip) and encoded (base64), so I need to be able to perform gunzip and base64 decode inside the C. I don't want to write any of the messages to file so... (2 Replies)
Discussion started by: handak9
2 Replies

3. Shell Programming and Scripting

Decode email

In pine email, when you receive an email with an attachment, the content of the attachment is incoded (content-transfer-encoding: base64). I am trying to write a shell script that will read the mail file, and it will save the attachment of an email to a directory. I want to do this by reading... (6 Replies)
Discussion started by: mskarica
6 Replies

4. Shell Programming and Scripting

auto decode a value to different value

Okay, This is not something I've tried to do before, but what I want (need) to do is when a value is read in it gets changed to the value needed. I've been given a list of ids that I need to check against the ids I have in my system, but as is the case we don't have the same naming convention... (2 Replies)
Discussion started by: nhatch
2 Replies

5. Programming

How to Decode an image using openGL

Hi, How to decode an image using openGL library libjpeg .. which are the steps needed to do this using C language.. actually my work is to decode the image, store it on the buffer, and place it on cube surface.. please guide me,,any answer will appreciated .. (8 Replies)
Discussion started by: Ravikishore
8 Replies

6. Linux

Decode the statement!!

What will the below statement do ?:confused: && { && {eval `/bin/setup 1`} || && { VAR="/tmp" } export $VAR; } (3 Replies)
Discussion started by: krishnaux
3 Replies

7. AIX

How to decompile or decode an executable?

I have a file type of: executable (RISC System/6000 V3.1) or obj module not stripped How can I decode it? I know that this may be somewhat involved, but if you could steer me in the right direction, I would appreciate it. Thanks! (2 Replies)
Discussion started by: gg48gg
2 Replies

8. Shell Programming and Scripting

How to decode text files?

HI experts....I am trying to decode some text files... I need little help from you people...file is of mixed type...from generated from windows based system my text files looks like this... 2.AUBZ 158 1 11 116204310 6 N 7542 E 18 02846 52833 102821 152815 ... (9 Replies)
Discussion started by: Akshay Hegde
9 Replies

9. UNIX for Dummies Questions & Answers

What does this command do? and how to decode all other lines

Hello, I have an encoded file and I wish to see what is written inside. The first line is given below: eval "$(dd if=$0 bs=1 skip=69 2>/dev/null|gpg -d 2>/dev/null)"; exit PS: When I google above code, it says that command is use for encryption... Following lines include many strange... (2 Replies)
Discussion started by: baris35
2 Replies

10. UNIX for Beginners Questions & Answers

Decode a file

hi i have this file : <?xml version="1.0" encoding="UTF-8"?> <OnDemand xmlns="http://xsd.telecomitalia.it/Schema/crmws.entity.OnDemand" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xsd.telecomitalia.it/Schema/crmws.entity.OnDemand... (2 Replies)
Discussion started by: Francesco_IT
2 Replies
Encode::MIME::Header(3pm)				 Perl Programmers Reference Guide				 Encode::MIME::Header(3pm)

NAME
Encode::MIME::Header -- MIME 'B' and 'Q' header encoding SYNOPSIS
use Encode qw/encode decode/; $utf8 = decode('MIME-Header', $header); $header = encode('MIME-Header', $utf8); ABSTRACT
This module implements RFC 2047 Mime Header Encoding. There are 3 variant encoding names; "MIME-Header", "MIME-B" and "MIME-Q". The difference is described below decode() encode() ---------------------------------------------- MIME-Header Both B and Q =?UTF-8?B?....?= MIME-B B only; Q croaks =?UTF-8?B?....?= MIME-Q Q only; B croaks =?UTF-8?Q?....?= DESCRIPTION
When you decode(=?encoding?X?ENCODED WORD?=), ENCODED WORD is extracted and decoded for X encoding (B for Base64, Q for Quoted-Printable). Then the decoded chunk is fed to decode(encoding). So long as encoding is supported by Encode, any source encoding is fine. When you encode, it just encodes UTF-8 string with X encoding then quoted with =?UTF-8?X?....?= . The parts that RFC 2047 forbids to encode are left as is and long lines are folded within 76 bytes per line. BUGS
It would be nice to support encoding to non-UTF8, such as =?ISO-2022-JP? and =?ISO-8859-1?= but that makes the implementation too complicated. These days major mail agents all support =?UTF-8? so I think it is just good enough. Due to popular demand, 'MIME-Header-ISO_2022_JP' was introduced by Makamaka. Thre are still too many MUAs especially cellular phone handsets which does not grok UTF-8. SEE ALSO
Encode RFC 2047, <http://www.faqs.org/rfcs/rfc2047.html> and many other locations. perl v5.18.2 2014-01-06 Encode::MIME::Header(3pm)
All times are GMT -4. The time now is 03:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy