08-07-2008
Thanks guys, you fixed the problem!
A new one though, how do you compare arrays? The whole thing reads:
for aa in 01 02 03
do
OrigNum[$aa]=$(grep -c ${Orig[$aa]} Ba3In2F12.prepos)
OrigNum[$aa]=$((${OrigNum[$aa]} - 1))
for bb in 01 02 03
do
for cc in 01 02 03
do
echo "${Orig[$bb]}" "${OrigNum[$bb]}"
echo "${Element[$cc]}" "${Numel[$cc]}"
if [ "${OrigNum[$bb]}"=="${Numel[$cc]}" ]; then
echo "SUCCESS!"
sed s/${Orig[$bb]}/${Element[$cc]}/ <Ba3In2F12.prepos>Ba3In2F12.preposterous
mv Ba3In2F12.preposterous Ba3In2F12.prepos
fi
done
done
done
I have an array called Numel[01-03], but when it compares, it always gives a success!!! I don't get it. Thanks! And sorry if these questions are elementary, I'm very new.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hey i have a small script in which i check if a file with that pattern exists or not. If present then i go ahead with further processing.
In the present situation i have only one file with that name and for loop is reading twice. Here is the script. And the output of debug mode. Please help.... (5 Replies)
Discussion started by: dsravan
5 Replies
2. UNIX for Dummies Questions & Answers
Hi
I have something like
cat $HOME/all_dirs | while read ln_old_dirs
do
if
then
echo "$ln_all_old_dirs"
fi
done
As you know that the variable ln_all_old_dirs is not accessable from outside the... (2 Replies)
Discussion started by: ssuresh1999
2 Replies
3. Shell Programming and Scripting
Hello,
basically what this script is supposed to do is showing a list of hosts that is given a number, that you will be able to choose from a list.
A check is made to verify that the chosen number is within the array and this is where things go bad and I don't know why, bizarre.
I've spent... (5 Replies)
Discussion started by: gand
5 Replies
4. Shell Programming and Scripting
I've got this problem, if I modify an array in the loop and print it, everything is fine as long as I stay in the loop. But, when I print it outside the loop, nothing happens... How can I solve this problem?
Here I prepared a sample for you to see my problem;
zgrw@Rain:~$ cat test
asd
123... (4 Replies)
Discussion started by: zgrw
4 Replies
5. Programming
I have a 2 d array that I need to loop through and check for a specific value in each variable...
Im a little confiused on how to do this...
#include stdio.h
#include string.h
main ()
{ char arrary;
memset(array,' ',sizeof(array));
for ?????
{ if ( array == ' ' )
{ do... (2 Replies)
Discussion started by: trey85stang
2 Replies
6. Shell Programming and Scripting
Hi All,
I am trying to run a do while for an array. And in the do while, I'm trying to get a user response. Depending on the the answer, I go ahead and do something or I move on to next element in the array.
So far I can read the array, but I can't get the if statement to work. Any suggestions... (5 Replies)
Discussion started by: nitin
5 Replies
7. Shell Programming and Scripting
Hello All,
Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....?
I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping
through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies
8. Shell Programming and Scripting
given an array of filenames files=(*) how can i loop over these in batches of four, or even better, work always with four files simultaneously.
i want do something with these files, always four of them simultaneously, and if one is ready the next should start.
one idea, but definitely not... (2 Replies)
Discussion started by: dietmar13
2 Replies
9. Shell Programming and Scripting
Here's my code:
awk -F '' 'NR==FNR {
if (/time/ && $5>10)
A=$2" "$3":"$4":"($5-01)
else if (/time/ && $5<01)
A=$2" "$3":"$4-01":"(59-$5)
else if (/time/ && $5<=10)
A=$2" "$3":"$4":0"($5-01)
else if (/close/) {
B=0
n1=n2;
... (2 Replies)
Discussion started by: klane
2 Replies
10. Shell Programming and Scripting
Hi there,
A bit new to bash and am having an issue with a for loop. I look for filenames in a specified directory and pull the date string from each meeting a certain criteria, and then would like to make a directory for each date found, like this:
search 20180101.gz 20180102.gz 20180103.gz... (5 Replies)
Discussion started by: mwheeler12
5 Replies
LEARN ABOUT CENTOS
xml::element
XML::Element(3) User Contributed Perl Documentation XML::Element(3)
NAME
XML::Element - XML elements with the same interface as HTML::Element
SYNOPSIS
[See HTML::Element]
METHODS AND ATTRIBUTES
delete_ignorable_whitespace
TODO: test and document this: with no tagname set, assumes ALL all-whitespace nodes are ignorable!
endtag
Redirects to HTML::Element::endtag_XML
starttag
Redirects to HTML::Element::starttag_XML
DESCRIPTION
This is just a subclass of HTML::Element. It works basically the same as HTML::Element, except that tagnames and attribute names aren't
forced to lowercase, as they are in HTML::Element.
HTML::Element describes everything you can do with this class.
CAVEATS
Has currently no handling of namespaces.
SEE ALSO
XML::TreeBuilder for a class that actually builds XML::Element structures.
HTML::Element for all documentation.
XML::DOM and XML::Twig for other XML document tree interfaces.
XML::Generator for more fun.
COPYRIGHT AND DISCLAIMERS
Copyright (c) 2000,2004 Sean M. Burke. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
AUTHOR
Current Author: Jeff Fearn <jfearn@cpan.org>.
Former Authors: Sean M. Burke, <sburke@cpan.org>
perl v5.16.3 2014-06-09 XML::Element(3)