Ok I need to parse a file but ALSO parse one of the columns in the file.
The file is delimited by | but the column I am parsing is delimited by '/'
Here is a sample record from the original file:
2008-08-28...
# i set my variable here
thisvar="abc"
echo $thisvar
# i go into my loop here and reset the variable
ls -l |
while IFS=":" read f1 f2
do
thisvar="xyz"
done
# display the supposed reset variable here
echo $thisvar
The result should be xyz but it remains abc
Why???
How can...
olded
That works if theres a file involved (myfile.txt). But theres no file. The output is coming from a linux command.
Can your snippet be modified top handle that?
-A
My command returns this:
Libsmbios: 0.8.0
System ID: 0x01B2
Service Tag: D*****1
Product Name: PowerEdge 2950
BIOS Version: 2.1.1
Vendor: Dell Inc.
Is Dell: 1
I need to loop through each row and move the value left of the ":" to one variable and the value to the right of the...
I just want to add to the end of an array. How is this done??? Seems so simple...
Heres my array:
arEquipment=(albert danielle daniel);
I would like to add element 'nathan' to the end.
How?
I cant copy files from a vista laptop to my xp desktop. I CAN see my desktop but I get 'you dont have permission to perform this action' when I try to paste a file onto the xp desktop.
I created a login on the xp desktop that matches the vista laptop, login and password.
On the xp machine I...
I am using the file_put_contents with the append option.
Code:
file_put_contents("filename", "text to write", FILE_APPEND);
Problem is that I want to lock the file as well as append.
Php documentation says to use the "LOCK_EX" flag, however, it does not have examples. How do I pass BOTH the...
OK. after hours of searching i found the "eq"
This works.
$setType="raise";
if ($setType eq "lower"){
print "in if \n";
}else{
print "in else \n";
}
in else
Sorry to trouble you!
ok how do I append a value to one element of the array?
CODE
my @aTest = (
[ 'albert', 'daniel', 'nathan' ],
[ 'danielle', 'mylee', 'rob' ],
);
#I want to add 'paul' ot @aTest[0]
foreach $row (@aTest){
foreach $col(@$row){
print "$col \n";
}
print "----- $row[1] \n";
}...
ishnid thank you...
MillerH, i scanned through the doc but it will take me hours to find what I need.
I already understand multidimensional arrays, I just need to know the perl syntax for it.
ishnid gave me the one character I needed "@"
Thanx!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.