02-08-2010
Thanks, Scritinizer. I forgot to mention, the original file also has blank lines in it which I want to store in the array as well. How can I modify the script so that I can store the blank values in the array?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to assign the contents of file e.g
ls "$HOME"
into an array. If it is possible then please guide me without using the concept of awk,sed, and perl16
Thanks (10 Replies)
Discussion started by: murtaza
10 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I do have a file and the contents are as follws:
10
20
30
40
50
Now I want to store those values into an array. How can be done this ?? (3 Replies)
Discussion started by: risshanth
3 Replies
3. UNIX for Dummies Questions & Answers
I have an array "arrA" with the following contents:
A0012 Paint Shop.doc
ES001 Contract Signature.doc
Budget Plan.pdf
TS PWS.pdf
My data file "Files.dat" has the same contents:
A0012 Paint Shop.doc
ES001 Contract Signature.doc
Budget Plan.pdf
TS PWS.pdf
I have a script that compares... (0 Replies)
Discussion started by: orahi001
0 Replies
4. Shell Programming and Scripting
Dear all,
I have a file having the following formats:
ThreadFail=Web1=1234
ThreadFail=Web2=2345
ThreadFail=Web3=12
ConnectionFail=DB1=11
ConnectionFail=DB2=22
The number of lines will be different from every time . How can I parse the file and store the result to an a array inside... (6 Replies)
Discussion started by: youareapkman
6 Replies
5. Shell Programming and Scripting
I want to store contents of command
dir in array of variables
For eg: dir contents are
command d2 demovi~ file inven java new untitled folder
d1 demovi er1 filename inven~ myfiles ubuntu desktop xmms
-----------------------------------
I... (3 Replies)
Discussion started by: netresearch
3 Replies
6. Shell Programming and Scripting
Hi all,
I am working on a backup based script, in which it enters to a directory and check the sub-directories and copy the names into an array.
cd $CPFs
k=0
for i in *
do
if
then
ARRs="$i"
k=$(($k+1))
#echo "$i"
... (19 Replies)
Discussion started by: canishk
19 Replies
7. Shell Programming and Scripting
I need to write a script to store the contents of a table in a csv file
I'm using Toad, it's a Oracle database. (5 Replies)
Discussion started by: ladyAnne
5 Replies
8. Shell Programming and Scripting
Hi Gurus,
I am trying for a scenario where in I want to read the contents of a file line by line and then store them in variables. Below is the script:
#!/bin/ksh
while read line
do
id=`echo $line | cut -f1 -d |`
name=`echo $line | cut -f2 -d |`
echo $id
... (11 Replies)
Discussion started by: svajhala
11 Replies
9. Shell Programming and Scripting
Hi,
I have a bash script that currently holds some data. I am trying to write all the contents to a file called temp.txt.
I am using
echo ${array} > temp.txt
The problem that I am experiencing is that the elements are being written horizontally in the file. I want them written... (5 Replies)
Discussion started by: Filter500
5 Replies
10. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
We must do the following for a massive coding project that is due at 12:20PM on Monday, July 22, 2013. We are to... (1 Reply)
Discussion started by: kowit010
1 Replies
APC_ADD(3) 1 APC_ADD(3)
apc_add - Cache a new variable in the data store
SYNOPSIS
bool apc_add (string $key, mixed $var, [int $ttl])
DESCRIPTION
array apc_add (array $values, [mixed $unused = NULL], [int $ttl])
Caches a variable in the data store, only if it's not already stored.
Note
Unlike many other mechanisms in PHP, variables stored using apc_add(3) will persist between requests (until the value is removed
from the cache).
PARAMETERS
o $key
- Store the variable using this name. $keys are cache-unique, so attempting to use apc_add(3) to store data with a key that
already exists will not overwrite the existing data, and will instead return FALSE. (This is the only difference between
apc_add(3) and apc_store(3).)
o $var
- The variable to store
o $ttl
- Time To Live; store $var in the cache for $ttl seconds. After the $ttl has passed, the stored variable will be expunged from the
cache (on the next request). If no $ttl is supplied (or if the $ttl is 0), the value will persist until it is removed from the
cache manually, or otherwise fails to exist in the cache (clear, restart, etc.).
o $values
- Names in key, variables in value.
RETURN VALUES
Returns TRUE if something has effectively been added into the cache, FALSE otherwise. Second syntax returns array with error keys.
EXAMPLES
Example #1
A apc_add(3) example
<?php
$bar = 'BAR';
apc_add('foo', $bar);
var_dump(apc_fetch('foo'));
echo "
";
$bar = 'NEVER GETS SET';
apc_add('foo', $bar);
var_dump(apc_fetch('foo'));
echo "
";
?>
The above example will output:
string(3) "BAR"
string(3) "BAR"
SEE ALSO
apc_store(3), apc_fetch(3), apc_delete(3).
PHP Documentation Group APC_ADD(3)