General :: Why Is Reading A FILE Faster Than Reading A VARIABLE?

May 4, 2011

I don't understand the results of a simple performance test I ran using two basic scripts (running on a high end server):

perfVar.zsh :

#!/bin/zsh -f
MYVAR=`cat $1`
for i in {1..10}

[code]...

Performance test result:

> time ./perfVar.zsh BigTextFile > /dev/null
./perfVar.zsh FE > /dev/null 6.86s user 0.32s system 100% cpu 7.177 total
> time ./perfCat.zsh BigTextFile > /dev/null
./perfCat.zsh FE > /dev/null 0.01s user 0.10s system 91% cpu 0.118 total

I would have thought that accessing a VARIABLE was way faster than reading a FILE on the file system... Why this result ?Is there a way to optimize the perfCat.zsh script by reducing the number of accesses to the file system ?

View 3 Replies


ADVERTISEMENT

General :: Reading File Into Variable In Bash?

Mar 21, 2011

I know that cat can output the file, but how do you store that output in a variable to process:

Code:

CONTENT=cat file.txt

This doesn't seem to work?

View 3 Replies View Related

Programming :: Zip A Variable With PERL Without Reading Or Writing A File?

Jun 20, 2010

There is the Archive::Zip I think I can use with Perl 5.10 but I don't know how. I don't want to read or write any files, just zip something in memory, with best compression, like

$text = "this is a test";
$zippedtext = &Zip($text);
sub Zip {

[code]...

I guess it's only a few lines.

View 3 Replies View Related

Ubuntu Networking :: Broadcom On 2.6.34 - Reinstall Error Code: Reading Package Lists ... Done Building Dependency Tree Reading State Information

May 20, 2010

i installed kernel 2.6.34 to fix my lid closing issue, and that went great. but now when i go to reinstall my broadcom i get this error. Code: Reading package lists... Done Building dependency tree Reading state information... Done bcmwl-kernel-source is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 1 not fully installed or removed. After this operation, 0B of additional disk space will be used. Setting up bcmwl-kernel-source (5.60.48.36+bdcom-0ubuntu3) ... Removing old bcmwl-5.60.48.36+bdcom DKMS files...

[Code].....

View 9 Replies View Related

General :: Reading Contents Of PDF File?

Jun 8, 2011

is there any API to read content of PDF file & store it in buffer?

View 14 Replies View Related

General :: Reading Info From One File In To Another?

Nov 17, 2010

been playing around making a server to play some games on running centos 5.5

what ive spent a while looking for (a few days) is a way to make a file which i will call startup this will contain some values

Code:
mod_directory="etpub"
port="27960"
log_name="console.log"
vm="0"
dedicated="2"

[Code].....

View 1 Replies View Related

General :: Reading The Contents Of A .bkf File Using A Non-Microsoft OS?

Apr 20, 2010

I have a .bkf backup file, created by the Backup utility that Microsoft provides with Windows XP. Is there a way to read the contents of the file using a non-Microsoft OS, preferably Mac OS X or Linux?

View 1 Replies View Related

General :: Bash: Reading File Into Array?

Dec 2, 2010

I have a file named file.txt with the following contents

Code:

19 man
24 house
44 dyam
90 random

I want to read the file into array and store each line in each index. I've tried using the following code.

Code:

dataarray=($( < file.txt ))

It stores each word in each index rather than each line in each index.

View 3 Replies View Related

General :: Oracle - Reading Alert Log File?

Mar 2, 2011

My requirement is that I wanted a shell script which should read the alert.log(oracle) and should send the alert to my email if any error encountered on daily basis. I have a script which does the same job but at the same time it creates a new alert.log whenever any error occur. But I don't want the new alert log I wanted to read the same alert log daily and if any new error come should alert as email.

View 3 Replies View Related

General :: Reading A File From A Remote Server?

Oct 15, 2010

I have an situation where I want to read a file into my script that lie on a remote server. I have ssh-keys set up just don't know how to do this.

View 7 Replies View Related

General :: Reading Changing File In Real Time

May 27, 2010

I know this command exists I just can't seem to find it. I want to see the last few lines of a file as more are added in real time. Can someone point me in the right direction?

View 2 Replies View Related

General :: Reading Numbers From Text File And Storing In Array?

May 26, 2010

I'm writing a bash script where I read a text file (containing a column of numbers) and store each line in an array. There seem to be some problems with the whole thing however, but only for some files and not others. Here's what I do:

Code:
#!/bin/bash
file=time_notOk.txt ### The file with a column of numbers
i=0 ### Array counter
### Read the file

[Code]....

View 3 Replies View Related

General :: Error Opening Matrix File (null) For Reading"

Dec 22, 2010

I have installed CUDA-BLASTP on C2050.It is giving me an Error:"Bad address Error opening matrix file (null) for reading" while i am running with following query file and dataset:

./CUDA-BLASTP -i ./data/raimondii_contigs.fasta -d ./data/DB_sorted.fasta

and i am using BLOSUM62 as a matrix file which is already present in package.

And getting the error:"Error happened when the number of GPUs is 0" while i am running CUDABLASTP with a part of dataset taking as a query file and dataset is same. above mentioned error is comming from file "CUDA_Blast.cu" included in package.

else
{
printf("Error happened when the number of GPUs is %d
", localGPU_N);
exit(0);
}

View 2 Replies View Related

General :: FTP Client As Like FTPS On Windows - Reading Series Of Ftp Commands From A Txt File

Apr 20, 2011

I am very new to Linux and trying to learn the shell scripting. Just to know is there any client in linux which does the same task as FTPS on windows. FTPS on windows can read series of FTP command from a txt file and execute them. Is there any way to do that same task, i mean reading series of ftp commands from a txt file, on linux suing shell or perl (any module)?

View 2 Replies View Related

General :: Bash + Reading Values (numbers) From A File And Storing Them Into An Array?

Nov 4, 2010

I have to read a couple of numbers from a random.txt file. In this .txt file there are random numbers. They are separated by a space. Example if you opened test.txt:

test.txt :1 6 1 3 6 8 10 2 4

I would like to read those numbers using CAT and store them into an array:

numlen=${#num[*]} - (must be like this because it is a part of a larger program)

View 5 Replies View Related

General :: Create A Multiple Files By Reading A Input File And Changing The Contents?

Sep 16, 2009

Being new to this area .I have been assigned a task which i am unable to do . Can any one please help me .

I have requirement where i have input file XYZ_111_999_YYYYMMDD_1.TXT and with header and series of Numbers and Footer.

I want to create a mutiple output files with each file having a seperate code which is stored in text file and create XYZ_222_999_YYYYMMDD_1.TXT . and add date in the contents next to series of numbers .Like this

Before change the file looks like this

file name XYZ_111_999_YYYYMMDD_1.TXT

001,19SEP2009-14:05:05,000000003
1234
4567
6785
END_OF_DATA

[Code]....

View 4 Replies View Related

General :: Reading A .CSV File And Then Calculating Average Per Minute Basis In Shell Script

Apr 23, 2010

I am new to shell script and to this form as well, I did try to search for a similar post like mine here, but could not find one.

Here is what I'm trying to do:

I am trying to grep server logs to find a specific string and then capture the time stamp and the value of that grep string in them. The log file prints out messages on per sec basis.

My script is able to grep the server logs for the entire period of my load runs and then outputted it to a .csv file too.

Unfortunately this .csv file is too large to extract it on my PC and to generate graphs as it exceeds the excel limit. I need some help on how to read this .csv file in a shell script and then take an average on per min basis before I can export it out on my desktop and generate graphs for analysis. example of the out in my .csv file:

View 1 Replies View Related

Programming :: Reading A Bash Variable In Bash Scripting ?

Nov 26, 2008

I have a config file that contains:

my.config:

Code:

Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.

Here is my parse_cmd script:

Code:

View 3 Replies View Related

Debian :: TAR - File Has Changed While Reading

Dec 17, 2010

I am using a backup system with cron + tar. Since the server is very busy, I get often the cron-email: "The file XYZ has changed while reading". This message is a bit annoying and I see it as critical point in my backup system. I believe that this file is then not in my backup. (Is that correct?) Let's imagine the hard disk dies and I have to recover the system and my personal data, and in the night the mysql-table XYZ was not in the backup, because it was in read-usage. I would then have lost this table forever. Is there any way to tell TAR, that it should force the file to be included (if in read-usage, then wait 2 seconds and try again)?

View 9 Replies View Related

Ubuntu Servers :: Not Reading XML File?

Jan 28, 2011

I recently set up a server in my house using Apache 2 running off Ubuntu 10.10 Netbook edition (no, the computer is a desktop). I tried running the website on a few computers in house and all the images and scripts seem to load fine but it is unable to read from the data.xml file through javascript. This leaves all of the web pages empty because all of the content is parsed from the xml file through javascript. I tried debugging with google chrome and after running this code to load the xml file:

if (window.XMLHttpRequest) {
// For IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}

[Code].....

the xmlhttp.responseXML is null and the script crashes. Could this be a permission issue? I tried setting the data.xml file to read-write permission for any user but that didn't work.

View 1 Replies View Related

Ubuntu :: Copying File - Error Reading From File Input/output

Jun 29, 2010

I have a 7.2 GB file (VMWare virtual machine file) that I am trying to copy from its original location to the another folder OR to external hard drive...each time I try to do this, I always get the following error after the copying process reach 'exactly' 1.4 GB

Error reading from file input/output error

And I have to either Cancel or Skip

I've tried to split the files to smaller pieces but the idea didn't work as I still get the same error whenever I try to compress/ split or do any operation with this file. how I can copy this file?

View 2 Replies View Related

Ubuntu :: Gnucash - Bug Detected While Reading QIF File

May 16, 2010

Running 10.04 64bit. Installed the latest Gnucash from repositories. Using Quicken 2003 and exported an account to a qif file. When trying to import to Gnucash the error "A bug was detected while reading the QIF file." displays. This, at least is more than I was able to do previously (prior to 10.04 and several earlier versions of Gnucash running in 8.04 through 9.10). Before it would cause Gnucash to crash and shutdown. I select a specific account with categories from Quicken to export. I can import to KMymoney and use it but that program is not compatible with the wife and does not do reconciliation reports by default.

View 3 Replies View Related

Programming :: Reading File - Output From Xrandr -q

Jul 24, 2010

Code:

I'm trying to make several files: each named after the display and containing resolutions. But for some reason I get null when trying to read lines.

View 2 Replies View Related

Networking :: Pxe Booting Is Not Reading Kickstart File?

Jun 27, 2010

i am trying to boot linux pc from network booting.. so using pxe,tftp,dhcp(1).i configured my /etc/dhcpd.conf file as...

ddns-update-style none;
ignore client-updates;
allow booting;

[code]....

View 5 Replies View Related

Programming :: Reading A Binary File Which Is In Hexadecimal

Jan 9, 2011

I have a binary file, which I need to process using my C++ application. Only thing I know is first chunk of the file is long, second chunk is int, third chunk is char etc... The binary file actually contains something like below. (which is represented in hex base).

D7 07 00 00 00 00 00 00 37 18 00 00 DE 07 ............ so on.....

I need to procees the file in the following way.

* I know the first data segment in my file is long. So it takes 4 bytes.
* so I need to read the first four bytes. That is D7 07 00 00.
* Then I need to reverse this as 00 00 07 D7.
* Finally I need to get the decimal value of above hexa decimal line. ( 00 00 07 D7)
* i.e. 00 00 07 D7 (in hex) = 7D7 (in hex- after removing leading 0 s) = 2007 (in decimal)

Like wise I need to process the whole file.

View 14 Replies View Related

Programming :: Reading Text File Into An Array

Oct 20, 2010

I know that this is a really simple thing to do but I just can't figure it out. How do I read a text file into an array in C++?

View 3 Replies View Related

Programming :: Reading A File Of Data In An Array?

Feb 10, 2011

I have two files of data with different numbers of columns and rows. I want to read this two files in two arrays and then compare for example the second column of first data file with the third column of the other text file and if the difference between of two numbers is less than a threshold then the program print the information in the rows which fulfill this condition in the third text file. I have written below program but the problem is that it does not go through all rows of second file.

declare -a a
declare -a b
r=` awk '{n++} END {print n}' second.txt `
echo $r
awk '
{

[Code]....

Actually I have two data files one of them contains 44406 and the other one has 12066 rows and I want to check whether the difference between the components of two specific columns is less than a threshod but I have simplified it here. I had written this code and then I have realized that this code just goes through the number of rows as the same as the first.txt file and ignores the rest. I could not find the problem yet.

View 2 Replies View Related

Programming :: Reading A Simple File Format In C?

Dec 16, 2010

I made a string key-value mapping struct in C, and functions to add and remove entries. I would also like to write a function to read in this file format:

Code:
key: value
another: another value

[code]...

View 14 Replies View Related

Programming :: Reading From Text File In Bash?

Nov 8, 2010

I need to Read a path of a file witch is written in Text file i used this

Code:

FILENAME=$1
while read line
do
echo $line
done < $FILENAME

it worked and showed me the Line witch was written in my file but now my problem is how am gonna use that line as a path i mean for example if am gonna execute a linux command on that file like dpkg -i /path/to/the/file how am gonna export it from The $Line variable and use it after the command.

View 14 Replies View Related

Programming :: Reading Lines Within A File (Perl)?

Mar 16, 2011

I am trying to read certain lines within a file and give the output of the certain lines that dont equal my value, I think showing you would be easier. There is multiples of these inside one file...

Code:

LV Name /dev/vg00/lvol1
LV Status available/syncd
LV Size (Mbytes) 300lable/syncd

[code]....

I want to read everything in the file, if the status is not available then it should display the name (directly above status). If they are all availbale then do nothing. I think I know how to do it which includes putting the info in string form and placing in hash but it is proving to be out of my skill range.

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved