472,340 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Problem for picking & manipulating particular line from /PROC/DISKSTAS

HI!
I 'm working on linux .I hv difficulty for picking particular line from a file...
I like to make some manipulation on LINE such as
3 sda7 333333 66666 888888 444444
from file /PROC/DISKSTATS
how I should proceed???
PLZ reply me if u hv answer......
i m waiting.......
Aug 9 '07 #1
3 1783
prn
254 Expert 100+
I'm afraid I don't have an answer. The reason is that you haven't give me a well-formed question.

You want to pick a particular line from a file. OK. What criteria do you have to select the line? What kind of manipulation do you intend to do?

We can't tell you how to pick a line if we don't know why you want to pick one line rather than another.

Regards,
Paul
Aug 9 '07 #2
HI!
I 'm working on linux .I hv difficulty for picking particular line from a file...
I like to make some manipulation on LINE such as
3 sda7 333333 66666 888888 444444
from file /PROC/DISKSTATS
how I should proceed???
PLZ reply me if u hv answer......
i m waiting.......
manipulations are :
1.to check how values such as 3333333(in above line )
changes every second i.e.after sleep(1);
2.how i will separate every values in above line...
Aug 10 '07 #3
prn
254 Expert 100+
Hi prassaad,

manipulations are :
1.to check how values such as 3333333(in above line )
changes every second i.e.after sleep(1);
2.how i will separate every values in above line...
That's still not very clear. I'll make some assumptions. Assuming that you want to pick the line with sda7, your script can just grep for sda7. To separate the elements of the line, you can use cut. Also, note that the fields in /proc/diskstats are separated by an unknown number of spaces, as in:
Expand|Select|Wrap|Line Numbers
  1.  
  2.    3    1 hda1 1282 2570 23 46
  3.    3    2 hda2 244191 3961445 2621545 20972360
  4.    3   64 hdb 11056 4657 473450 256563 60696 17135 623128 330075 0 150236 586641
  5.    3   65 hdb1 15595 472418 77894 623128
so you may need to "squash" them together to get a single space. Thus, if I wanted to extract the field immediately following "hda2" in the excerpt above, I might write:
Expand|Select|Wrap|Line Numbers
  1. #! /bin/sh
  2. while [ true ]
  3. do
  4.     grep hda2 /proc/diskstats | tr -s ' ' | cut -d ' ' -f5
  5.     sleep 1
  6. done
Without knowing any more than you have told us, that's about the best anyone can do for you.

HTH,
Paul
Aug 13 '07 #4

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

Similar topics

1
by: Brad H McCollum | last post by:
I'm writing an application using VB 6.0 as the front-end GUI, and the MSDE version of SQL Server as the back-end (it's a program for a really small...
7
by: pb648174 | last post by:
I am trying to add a column to a temp table and then immeditaely query against that new column. If I do this in Query Analyzer it works fine as...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java...
3
by: Chris | last post by:
Modal forms are great for locking the user out of non focused forms allowing tight control over program flow, but they have one side effect which...
15
by: Madhanmohan S | last post by:
Hi All, I want to run a command line appplication from C#. When i start the application, it will go into specific mode. After that, i have to give...
0
by: Will Asrari | last post by:
In my code I have created a Process for opening up a command line executable using System.Diagnostics.Process that imports a csv full of Generic...
1
by: ARC | last post by:
I have some functions that will allow a user to attach to a different back-end database. I added this functionality to the program Ribbon in a...
1
by: NeoGregorian | last post by:
Hello, I am writing a wrapper to a basic Input/Output programs (where you type a one line command at a time and then get 0 or more lines of output...
1
by: Dan Upton | last post by:
Or: How to write Python like a Python programmer, not a Java programmer. This will be a little long-winded... So I just recently started picking...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.