473,492 Members | 4,279 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

16 New Member
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 1840
prn
254 Recognized Expert Contributor
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
prassaad
16 New Member
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 Recognized Expert Contributor
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
3053
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 # of users --- less then 3-4). I'm trying to...
7
2601
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 long as there is a go in between, but I can't use a...
2
9196
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 packages (for code reuse). I encountered...
3
4917
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 user find very irritating i.e. Access cannot be...
15
14034
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 commands to use the application. How Can This Be...
0
1047
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 Authorization account information to numerous tables...
1
1687
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 custom Access 2007 app. I have 2 ways to attach to a...
1
2434
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 before you can input the next command). I'm...
1
1068
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 up Python, mostly learning the new bits I need...
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6862
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
7364
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...
1
4886
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...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.