Sponsored Content
Top Forums Shell Programming and Scripting Capturing text & putting it in different variables Post 302479856 by anushree.a on Monday 13th of December 2010 05:57:11 AM
Old 12-13-2010
Thanks Franklin52.
Solution worked...
Thanx a lot
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capturing text between ()

Heyo all, I'm looking for the most effective way to capture the text in between a set of parenthesis. For example, my input is this(IBM WebSphereMQ Queue Manager Status): QMNAME(Q1) STATUS(Ended immediately) QMNAME(Q2) ... (7 Replies)
Discussion started by: sysera
7 Replies

2. Shell Programming and Scripting

scripting headache... loops & variables

Surely there's an easier way to do this, lets see if anyone knows! I am new to scripting so go easy on me! I have the following script and at the moment it doesn't work and I believe the problem is that I am using a while loop within a while loop. When I run the script using sh -x I can see... (6 Replies)
Discussion started by: StevePace
6 Replies

3. UNIX for Dummies Questions & Answers

Putting echoed text into a new file

Hi, I've set up a script so that a user answers questions, and then these answers come back onto the screen accompanied by text that I've echoed. Is there a way of putting this into a new file? Thanks (7 Replies)
Discussion started by: likelylad
7 Replies

4. Shell Programming and Scripting

regex to remove text before&&after comma chars

Hi, all: I have a question about "cleaning up" a huge file with regular expression(s) and sed: The init file goes like this: block1,blah-blah-blah-blah,numseries1,numseries2,numseries3,numseries4 block2,blah-blah-blah-blah-blah,numseries,numseries2,numseries3,numseries4 ...... (3 Replies)
Discussion started by: yomaya
3 Replies

5. Shell Programming and Scripting

How to check & reset variables

Hi, I'm dealing with a small problem here that I can't seem to overcome by myself. Any help would be greatly appreciated :) Basically, I have three variables, EXTSUB1, EXTSUB2 and EXTSUB3. These variables carry a file the user provides. What I need is to check each of the variables and if the... (1 Reply)
Discussion started by: mutex1
1 Replies

6. Shell Programming and Scripting

Shell Variables & awk...Help Please

I apologize if this topic has been beaten to death here, but my limited searching skills did not throw up any results. Here's what I am trying to accomplish List all the files in a certain directory; assign the file names to an array which will be used later in the script. My script looks like... (2 Replies)
Discussion started by: kash80
2 Replies

7. Shell Programming and Scripting

Read record from the text file & assign those values to variables in the script

For eg: I have sample.txt file with 4 rows of record like: user1|password1 user2|password2 user3|password3 user4|password4 The username and password is sepsrated by '|' I want to get the 1st row value from the file and assign it to two different variables(username and password) in my... (1 Reply)
Discussion started by: priya001
1 Replies

8. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

9. Shell Programming and Scripting

Copy files based on specific word in a file name & its extension and putting it in required location

Hello All, Since i'm relatively new in shell script need your guidance. I'm copying files manually based on a specific word in a file name and its extension and then moving it into some destination folder. so if filename contains hyr word and it has .md and .db extension; it will move to TUM/HYR... (13 Replies)
Discussion started by: prajaktaraut
13 Replies

10. UNIX for Beginners Questions & Answers

Question about global environment variables & fork() exec()

Hello... And thanks in advance for any help anyone can offer me on my question! I've been doing a lot of reading to try and find my answer... But I haven't had any luck What I'm trying to understand is where a child process inherits global environment variables from? I understand the exec()... (2 Replies)
Discussion started by: bodisha
2 Replies
Data::Serializer::Cookbook(3pm) 			User Contributed Perl Documentation			   Data::Serializer::Cookbook(3pm)

NAME
Cookbook - Examples of how to use Data::Serializer DESCRIPTION
Data::Serializer::Cookbook is a collection of solutions for using Data::Serializer. CONVENTIONS
Unless otherwise specified, all examples can be assumed to begin with: use Data::Serializer; my $serializer = Data::Serializer->new(); Some examples will show different arguments to the new method, where specified simply use that line instead of the simple form above. CONVENTIONS for Raw Access Fort hose who want a straight pass through to the underlying serializer, where nothing else is done (no encoding, encryption, compression, etc) there is Data::Serializer::Raw(3). These begin like this: use Data::Serializer::Raw; my $raw_serializer = Data::Serializer::Raw->new(); Encrypting your data You wish to encrypt your data structure, so that it can only be decoded by someone who shares the same key. Solution $serializer->secret('mysecret'); my $encrypted_hashref = $serializer->serializer($hash); ... (in other program) ... $serializer->secret('mysecret'); my $clear_hash = $serializer->deserializer($encrypted_hash); Note: You will have to have the Crypt::CBC module installed for this to work. Compressing your data You wish to compress your data structure to cut down on how much disk space it will take up. Solution $serializer->compress(1); my $compressed_hashref = $serializer->serializer($hash); ... (in other program) ... my $clear_hash = $serializer->deserializer($compressed_hash); Note: You will have to have the Compress::Zlib module installed for this to work. Your mileage will vary dramatically depending on what serializer you use. Some serializers are already fairly compact. You want to read in data serialized outside of Data::Serializer You need to write a program that can read in data serialized in a format other than Data::Serializer. For example you need to be able to be able to process data serialized by XML::Dumper. Solution use Data::Serializer::Raw; my $xml_raw_serializer = Data::Serializer::Raw->(serializer => 'XML::Dumper'); my $hash_ref = $xml_raw_serializer->deserialize($xml_data); You want to write serialized data in a form understood outside of Data::Serializer You need to write a program that can write out data in a format other than Data::Serializer. Or said more generically you need to write out data in the format native to the underlying serializer. For our example we will be exporting data using XML::Dumper format. Solution ues Data::Serializer::Raw; my $xml_raw_serializer = Data::Serializer::Raw->(serializer => 'XML::Dumper'); my $xml_data = $xml_raw_serializer->serialize($hash_ref); You want to convert data between two different serializers native formats You have data serialized by php that you want to convert to xml for use by other programs. Solution use Data::Serializer::Raw; my $xml_raw_serializer = Data::Serializer::Raw->(serializer => 'XML::Dumper'); my $php_raw_serializer = Data::Serializer::Raw->(serializer => 'PHP::Serialization'); my $hash_ref = $php_raw_serializer->deserialize($php_data); my $xml_data = $xml_raw_serializer->serialize($hash_ref); Keeping data persistent between executions of a program. You have a program that you run every 10 minutes, it uses SNMP to pull some counters from one of your routers. You want your program to keep the counters from the last run so that it can see how much traffic has passed over a link since it last ran. Solution # path to store our serialized data # be paranoid, use full paths my $last_run_datafile = '/full/path/to/file/lastrun.data'; #We keep our data as a hash reference my $last_data = $serializer->retrieve($last_run_datafile); #Pull in our new data through 'pull_data()'; my $new_data = query_router($router); #run comparison code run_comparison($last_data,$new_data); $serializer->store($new_data); AUTHOR
Neil Neely <neil@neely.cx>. COPYRIGHT
Copyright (c) 2001-2011 Neil Neely. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Data::Serializer(3) Data::Serializer::Raw(3) perl v5.12.4 2011-08-16 Data::Serializer::Cookbook(3pm)
All times are GMT -4. The time now is 07:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy