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
ADVERTISEMENT
Jan 27, 2010
With array in php. All I was having the following columns:
Code:
Now Like the Above there were more variables defined through script:
Code:
Now what the above code is doing is calculating average of above values from columns{1-?,4-?)..likewise
Say If I remove two Machine and calculate the avg.
View 1 Replies
View Related
Apr 25, 2010
I'm trying to write a python script that will calculate my test scores from a text file named "exams."
Sample input would be:
Output will look like:
I have the following code:
Code:
My intent is to sum the values found in L and divide by len(L).
I think my issue is that when I split the values, I get a string array (ex. ['85', '90'] ), which makes it hard to do calculations.
View 5 Replies
View Related
Apr 20, 2011
I have a data in a column.
Code:
I want to calculate average and standard deviation. As first step I want to calculate average for the data than calculate (del=data - avg) for all the data.
I suppose get
Code:
For this I use AWK and the code goes like this
Code:
But I get different answers.
Code:
Why the answers are so different? since this is wrong I can not continue calculating the standard deviation.
View 6 Replies
View Related
Feb 3, 2010
I'm writing a script and I'm stuck. I need to read from keyboard to ask for confirmation while Im reading from a file. My code is this:
while read linea
do #code
echo "you sure? (y/n)"
read answer
#code
done < $"agenda.dat"
The problem is that stdinput has been redirected to file agenda.dat so when I do "read answer" it reads the next line from the file.
View 11 Replies
View Related
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
View Related
Sep 10, 2009
Actually i m new to scripting in Linux, we have RedHat Server Edition 4 in which different software licences are installed and software itself installed at client side. the usage of the software is recorded daily in a text file which is of format
I want to write a script that checks that for any OUT & IN, if utility, user and Client PC Name are same then subtract OUT Time from IN Time. This has to be done for each & every user and utility.Is there any GUI programming possible in Linux.
View 7 Replies
View Related
Oct 26, 2010
I need to process a log file on an hourly basis but the log only rotates once a day.Basically, I am trying to get the difference between the previous file and the current file based on datetime. ie. The new file's datetime events > previous file's datetime events.The first field in the files is datetime.
Code:
2010-10-27 01:57:32,aaa.bbb.ccc.ddd,host1
2010-10-27 01:57:32,aaa.bbb.ccc.ddd,host2
[code]...
View 4 Replies
View Related
Jun 8, 2011
is there any API to read content of PDF file & store it in buffer?
View 14 Replies
View Related
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
Oct 25, 2010
I am trying to read the fields of a file and manipulate them, record by record. Lets say using awk :
awk -F":" `{print $1 $2 $3 $4 $5}' TrackMsgFile.0806`
This prints my fields on screen.But I dont want to print these fields while reading the records instead store them in some variable and manipulate them as per my logic. Does "awk" or some other shell command provides something for this ?
View 14 Replies
View Related
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
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
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
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
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
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
Apr 29, 2010
I have a file which has several entries with
# comment 1
1245
# comment 2
5667
# comment 3
456456
how can I read the file, sum the numbers ( "avoid" the #lines) and then get the average of the numbers?
I do awk '{s+=$0} END {print s}' /tmp/file.txt. and this give me the sum correctly, but how can I get also the average ?
View 4 Replies
View Related
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
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
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
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
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
May 12, 2010
i just accidentally shift-deleted a 6gb avi file a minute ago. is it possible to recover it and how? im using lucid and ext4.
View 1 Replies
View Related
May 13, 2010
What originally seemed like an easy thing to calculate has given me a big headache. Perhaps someone can help me with my issue. I am trying to find, in particular, how much memory certain application processes are taking. The process always is the same name, main_server, but with an argument to tell it what to do when running as a daemon.
When running the following command against all "main_server" processes, it produces a result in megabytes based on the output of the rss field in 'ps'.
Code:
CALC=0
for ea in
`ps -e -orss=,args= |
sort -b -k1,1n |
pr -TW$COLUMNS |
grep main_server |
grep -v "grep main_server" |
[Code]...
Currently I am left scratching my head. For capacity planning purposes, it would be nice to know how many more 'main_server' processes could run on the system without causing it to swap. Knowing the buffer and cache usage will go down as running processes demand more memory, I prefer to look at the free memory excluding cache and buffers. However, since 'ps' is reporting the processes are using more memory than free reports is in use without those things, I have no way to know how many more processes the system can support. I played around with different fields in 'ps', such as vsize, size, etc, but with no luck in matching up any numbers.
View 7 Replies
View Related
Feb 17, 2010
I'm trying to create a script that will find the bandwidth usage of certain protocols only. For example, SMTP. I would like it to just return a number. Is there a known command/parameters to output something like this?
View 2 Replies
View Related
Aug 14, 2010
I am currently doing RHCE. I want to make projects on basis of this.
View 8 Replies
View Related
Dec 9, 2008
How can I read .gz file direct on shell/terminal without decompressing the file?
satimis
View 5 Replies
View Related
Mar 30, 2010
I need a shell script that will add the users name and date to a file when the user has modified the file, these files are within a group and only accessible to this group. But we need a way for people in the group to know who and when the file was last modified.
View 1 Replies
View Related
May 23, 2011
i am trying to convert a binary file in to ASCII using shell script. this file contains multiple types of data like string, number, bcd, etc.
View 5 Replies
View Related