Sponsored Content
Top Forums Shell Programming and Scripting Is it possible to have a for loop inside another for loop? Post 302396085 by DoxieLvr on Wednesday 17th of February 2010 04:23:52 PM
Old 02-17-2010
Quote:
Originally Posted by cfajohnson
Those are not standard commands.
Sorry. I'm use to bash and didn't notice he was using sh.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

while loop inside while loop

Dear All, i have a awk script where i'm using while loop inside while loop here is the code: awk -v DATE="$CURRDATE" -v -F'@' 'BEGIN { while(( getline < "Merge_Calldet.txt" )) { ARR=$5 LINE=$0 while(( getline < "Merge_Accessnum.txt" )) { TESTSIMENTRY=$1 FILEDATE=$15 ... (0 Replies)
Discussion started by: panknil
0 Replies

2. Shell Programming and Scripting

Using variables created sequentially in a loop while still inside of the loop [bash]

I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends. As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

3. UNIX for Dummies Questions & Answers

SED inside while loop

Hi, im having problem creating a loop using my code: aside from the fact that the 1st variable (VAR) does not increment, it loops more than the expected output. for sample purposes, test csv contains 3 lines. #get number of lines in the file lines=$( wc -l < test.csv ) ... (5 Replies)
Discussion started by: paoie
5 Replies

4. Shell Programming and Scripting

Using 'su' inside a loop

Hi, I am using su within a for loop. As you might expect, it prompts for password during each loop execution. Here is my piece of code: for i in $LIST do if then DATABASE=`echo $i | awk -F "|" '{ print $1 }'` USER_ID=`echo $i | awk -F "|" '{ print $2 }'` su - apstage -c... (1 Reply)
Discussion started by: sugan
1 Replies

5. Shell Programming and Scripting

Need help using sed inside the loop.

Hi, i have written a script. it collects data based on the sql queries executed by it. i have multiple output files. after the output file is made i need to do some cosmetic changes in the files and then store them. i am unable to use sed conditions inside the loop. see below code for... (3 Replies)
Discussion started by: dazdseg
3 Replies

6. Shell Programming and Scripting

BASH loop inside a loop question

Hi all Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Discussion started by: rethink
4 Replies

7. Shell Programming and Scripting

For Loop inside For loop

I am new to unix and trying to make a script for writing all my command into another file and use that file to run all commands I am trying to use for loop with echo command to generate a command based script for writing the file with all the command sequentially w.r.t for loop. I want... (6 Replies)
Discussion started by: nnani
6 Replies

8. UNIX for Dummies Questions & Answers

while loop inside a for loop

Hi, I am a newbie and would like to create a shell script that will move one file at a time from one path to another path in the same server. However, the next file should wait until the first file gets deleted by an application. I tried creating the script but right after the first file has... (1 Reply)
Discussion started by: rgomons
1 Replies

9. Shell Programming and Scripting

If inside If loop

Hi All, Below is the very simple code snippet but it si giving me syntax error #!/bin/bash #To ensure If JMS directory exists or not ServerName=$(hostname) #To ensure If JMS directory exists or not echo $ServerName if ; then echo "Inside First If" if ; then echo 'JMS... (4 Replies)
Discussion started by: sharsour
4 Replies

10. UNIX for Dummies Questions & Answers

Write a while loop inside for loop?

I'm taking a unix class and need to countdown to 0 from whatever number the user inputs. I know how to do this with a while or until loop but using the for loop is throwing me off.... I know I can use an if-then statement in my for loop but can I include a while loop in my for loop? (3 Replies)
Discussion started by: xxhieixx
3 Replies
DumpXML(3pm)						User Contributed Perl Documentation					      DumpXML(3pm)

NAME
Data::DumpXML - Dump arbitrary data structures as XML SYNOPSIS
use Data::DumpXML qw(dump_xml); $xml = dump_xml(@list) DESCRIPTION
This module provides a single function called dump_xml() that takes a list of Perl values as its argument and produces a string as its result. The string returned is an XML document that represents any Perl data structures passed to the function. Reference loops are han- dled correctly. The following data model is used: data : scalar* scalar = undef | str | ref | alias ref : scalar | array | hash | glob | code array: scalar* hash: (key scalar)* The distribution comes with an XML schema and a DTD that more formally describe this structure. As an example of the XML documents produced, the following call: $a = bless [1,2], "Foo"; dump_xml($a); produces: <?xml version="1.0" encoding="US-ASCII"?> <data xmlns="http://www.cpan.org/.../Data-DumpXML.xsd"> <ref> <array class="Foo"> <str>1</str> <str>2</str> </array> </ref> </data> If dump_xml() is called in a void context, then the dump is printed on STDERR automatically. For compatibility with "Data::Dump", there is also an alias for dump_xml() called simply dump(). "Data::DumpXML::Parser" is a class that can restore data structures dumped by dump_xml(). Configuration variables The generated XML is influenced by a set of configuration variables. If you modify them, then it is a good idea to localize the effect. For example: sub my_dump_xml { local $Data::DumpXML::INDENT = ""; local $Data::DumpXML::XML_DECL = 0; local $Data::DumpXML::DTD_LOCATION = ""; local $Data::DumpXML::NS_PREFIX = "dumpxml"; return dump_xml(@_); } The variables are: $Data::DumpXML::INDENT You can set the variable $Data::DumpXML::INDENT to control the amount of indenting. The variable contains the whitespace you want to be used for each level of indenting. The default is a single space. To suppress indenting, set it to "". $Data::DumpXML::INDENT_STYLE This variable controls where end element are placed. If you set this variable to the value "Lisp" then end tags are not prefixed by NL. This give a more compact output. $Data::DumpXML::XML_DECL This boolean variable controls whether an XML declaration should be prefixed to the output. The XML declaration is the <?xml ...?> thingy. The default is 1. Set this value to 0 to suppress the declaration. $Data::DumpXML::NAMESPACE This variable contains the namespace used for the XML elements. The default is to let this be a URI that actually resolve to the XML schema on CPAN. Set it to "" to disable use of namespaces. $Data::DumpXML::NS_PREFIX This variable contains the namespace prefix to use on the elements. The default is "", which means that a default namespace will be declared. $Data::DumpXML::SCHEMA_LOCATION This variable contains the location of the XML schema. If this variable is non-empty, then an "xsi:schemaLocation" attribute is added to the top level "data" element. The default is not to include this, as the location can be inferred from the default XML namespace used. $Data::DumpXML::DTD_LOCATION This variable contains the location of the DTD. If this variable is non-empty, then a <!DOCTYPE ...> is included in the output. The default is to point to the DTD on CPAN. Set it to "" to suppress the <!DOCTYPE ...> line. BUGS
Class names with 8-bit characters are dumped as Latin-1, but converted to UTF-8 when restored by the Data::DumpXML::Parser. The content of globs and subroutines are not dumped. They are restored as the strings "** glob **" and "** code **". LVALUE and IO objects are not dumped at all. They simply disappear from the restored data structure. SEE ALSO
Data::DumpXML::Parser, XML::Parser, XML::Dumper, Data::Dump AUTHORS
The "Data::DumpXML" module is written by Gisle Aas <gisle@aas.no>, based on "Data::Dump". The "Data::Dump" module was written by Gisle Aas, based on "Data::Dumper" by Gurusamy Sarathy <gsar@umich.edu>. Copyright 1998-2003 Gisle Aas. Copyright 1996-1998 Gurusamy Sarathy. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.8.8 2006-04-08 DumpXML(3pm)
All times are GMT -4. The time now is 04:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy