473,411 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

(standard_in) 1: parse error

Expand|Select|Wrap|Line Numbers
  1. #!/bin/bash
  2. #sar.sh
  3. i=1
  4. while read myline
  5. do
  6.     if [ $i -eq 1 ]
  7.     then
  8.         echo "Report Date: $(cut -d" " -f4 ornek2-c.txt)" > output.txt
  9.     elif [ $i -gt 3 ]
  10.     then
  11.         echo $myline > temp.txt
  12.         proc=$(cut -d" " -f3 temp.txt)
  13.         echo $proc > temp.txt
  14.         cat temp.txt >> temp2.txt
  15.     fi
  16.     i=$(expr $i + 1)
  17. done <ornek2-c.txt
  18.  
  19. index=$(expr $i - 4)
  20.  
  21. cat temp2.txt | awk '{ sum+=$1 } END {print sum}'
  22. average=$(echo "scale=4; $sum/$index"|bc)
  23. echo $average
  24. exit 0
  25.  
ornek2-c.txt: http://www.rafb.net/paste/results/xKMpYT30.html

the output after execution(./sar.sh):

144
42.91
(standard_in) 1: parse error

i created ornek2-c.txt file with "sar -c -f ornek2.sa > ornek2-c.txt" command.i'm trying to find the average value of the proc/s column in ornek2-c.txt.

Thanks in advance.
Dec 13 '06 #1
1 8356
Expand|Select|Wrap|Line Numbers
  1. cat temp2.txt | awk '{ sum+=$1 } END {print sum}'
  2. average=$(echo "scale=4; $sum/$index"|bc)
  3.  
Expand|Select|Wrap|Line Numbers
  1. sum=$( cat temp2.txt | awk '{ sum+=$1 } END {print sum}' )
  2. average=$(echo "scale=4; $sum/$index" | bc)
  3.  
editing two lines as above solved the problem.
Dec 13 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: H.L Bai | last post by:
hi, everybody i meet a parse error when i used the xml4c. any proposal is helpful. The error is following .../XMLRegionHandler.h:59 parse error before '*' .../XMLRegionHandler.h:60 parse...
21
by: BWIGLEY | last post by:
Basically I've just started making a game. So far it makes an array 25 by 20 and tries to make five rooms within it. In scr_make_room() there's parse errors: 20 C:\c\Rooms\Untitled1.c parse error...
6
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar...
0
by: tsivaraman | last post by:
I am trying to build php-5.2.1 in RedHat Linux 9. I have installed libxml2-2.6.11,mysql-5.0.33,httpd-2.2.4(apache) successfully.When i do 'make' from the php directory,i get the following...
1
by: Phaelle | last post by:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' What does that error mean? I can´t find the mistake!! In another script, I have got another kind of mistake : parse...
0
by: Rory McKinley | last post by:
Hi I am trying to use the TidyHTMLTreeBuilder module which is part of elementtidy, but I am getting what appears to be some sort of scope error and it is scrambling my n00b brain. The module...
2
by: Lawrence Krubner | last post by:
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString",...
5
by: goldtech | last post by:
SAX XML Parse Python error message Hi, My first attempt at SAX, but have an error message I need help with. I cite the error message, code, and xml below. Be grateful if anyone can tell me...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.