07-06-2006
i tried to escape the $ with \ but still it didnt work
all the time either it gives error or print only 0th element even though j is 2 or 3
quite strange
any working code ?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to run an awk split on a value that has been pushed through an array and I was wondering what the syntax should be??
e.g. running time strings through an array and trying to examine just minutes:
12:25:30
10:15:13
08:55:23
awk '
NR==FNR{
... (2 Replies)
Discussion started by: dcfargo
2 Replies
2. Shell Programming and Scripting
Hi All,
I have the following code sequence for reading some bulk file and moving the content to two different arrays.
while read data
do
THREEG_PATTERN=`echo $data | egrep "3G"`
if
then
NEW_THREEG_PATTERN=`echo $THREEG_PATTERN | cut -d " " -f2`
... (12 Replies)
Discussion started by: subin_bala
12 Replies
3. Shell Programming and Scripting
Hi all,
ssh uname@remote_server 'cat /tmp/remote_file_name > home_dir/a512386/new/local_file_name'
The above given command is working fine.
but if i try to move the file only if exists in the remote server i.e) giving the same within if condition it executes but the file is not stored in my... (1 Reply)
Discussion started by: Shri123
1 Replies
4. Shell Programming and Scripting
Hi,
Am not very well versed with unix, i wrote a script which will make a new file using cat option like this,
trans.sh
#!/bin/sh
cat > file1
echo how are you
I wrote only this part since i want to use this concept for something else. What i want to ask is, this script when executed... (4 Replies)
Discussion started by: romsf
4 Replies
5. Shell Programming and Scripting
Hello I have the file df.tmp
FS is actually the / FS but escape character\ and end of line $ is used in order to fetch exctly / and not other filesystems.
awk '/\/$/ {print $(NF-1)+0}' df.tmp will work properly and return a value eg. 60
but when I am trying to issue the command with the array... (3 Replies)
Discussion started by: drbiloukos
3 Replies
6. Shell Programming and Scripting
I have a file
root@server # cat /root/list12
11.22.33.44
22.33.44.55
33.44.55.66
33.44.55.66
33.44.55.66
I try to pass to array and display unique.
root@server# cat /root/test12.sh
#!/bin/bash
#delcare array badips and accumulate values to array elemenrs
badips=( $( cat... (4 Replies)
Discussion started by: anil510
4 Replies
7. Shell Programming and Scripting
There are 4 files inside one folder matching criteria i.e. File name = ABCJmdmfbsjopXXXXXXX_mm-dd-yyyy_XXX.data
Here is the Code which find the files matching criteria:-
TS=`date +"%m-%d-%Y"`| for fname in `find . -name "ABCJmdmfbsjop???????_${TS}*.data"`
do # Matching File Processing Code.... (1 Reply)
Discussion started by: lancesunny
1 Replies
8. Shell Programming and Scripting
I tried to use variable inside an array variable, but its not working as expected.:wall:
ENV1=123
ENV1=789
ENV1=120
ENV2=567
if
then
name=ENV1
echo "${name}"
echo "${name}"
echo "${name}"
else
name=ENV1
echo "${name}"
fi
Output: ./val.sh 1
123 (2 Replies)
Discussion started by: Jayavinoth
2 Replies
9. UNIX for Dummies Questions & Answers
Hi guys
Let me at first describe the whole thing that I'm trying to do. Lets say I have 100 files like the following one.
Ow 1230 16.000000 -0.834000 16.083957
1.751652398 -17.20094528 -4.450623277
Hw 1231 ... (6 Replies)
Discussion started by: saleheen
6 Replies
10. Programming
const int VALUES = {7,4,2,1,0}; //or int VALUES = {7,4,2,1,0};this statement inside a class definition gives error. Why? (3 Replies)
Discussion started by: milhan
3 Replies
LEARN ABOUT OSX
xml::libxml::attributehash
XML::LibXML::AttributeHash(3) User Contributed Perl Documentation XML::LibXML::AttributeHash(3)
NAME
XML::LibXML::AttributeHash - tie an XML::LibXML::Element to a hash to access its attributes
SYNOPSIS
tie my %hash, 'XML::LibXML::AttributeHash', $element;
$hash{'href'} = 'http://example.com/';
print $element->getAttribute('href') . "
";
DESCRIPTION
This class allows an element's attributes to be accessed as if they were a plain old Perl hash. Attribute names become hash keys.
Namespaced attributes are keyed using Clark notation.
my $XLINK = 'http://www.w3.org/1999/xlink';
tie my %hash, 'XML::LibXML::AttributeHash', $element;
$hash{"{$XLINK}href"} = 'http://localhost/';
print $element->getAttributeNS($XLINK, 'href') . "
";
There is rarely any need to use XML::LibXML::AttributeHash directly. In general, it is possible to take advantage of XML::LibXML::Element's
overloading. The example in the SYNOPSIS could have been written:
$element->{'href'} = 'http://example.com/';
print $element->getAttribute('href') . "
";
The tie interface allows the passing of additional arguments to XML::LibXML::AttributeHash:
tie my %hash, 'XML::LibXML::AttributeHash', $element, %args;
Currently only one argument is supported, the boolean "weaken" which (if true) indicates that the tied object's reference to the element
should be a weak reference. This is used by XML::LibXML::Element's overloading. The "weaken" argument is ignored if you don't have a
working Scalar::Util::weaken.
perl v5.16.2 2012-10-22 XML::LibXML::AttributeHash(3)