Sponsored Content
Top Forums Shell Programming and Scripting print out result from data file Post 302162766 by thms_sum on Wednesday 30th of January 2008 03:27:30 AM
Old 01-30-2008
print out result from data file

i got a data file which contains all the pid,ppid,user,command,pcpu,start_time,status. I wanted to display out the pcpu which is greater than 0.

i uses awk'{if($5 > 0){print}}' filename.txt but is printing out result which not i wanted. Is there any way which i can print out those pcpu which is greater than 0?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print a function result in new file

Hi, i have a function which return a variable . serach ( paramatere) when i excute this function i get the result in the shell, i want to print this result in a file by calling just the function. how can i do it.. the code example is like that: search ( ) { .. } the call... (0 Replies)
Discussion started by: kamel.seg
0 Replies

2. UNIX for Advanced & Expert Users

How to print data between 2 lines in a file

i want to print the data between two line numbers in file to another file. which command should i use i tried sed command . i am storing the line numbers in two variables say L1,L2. but $L1 and $L2 are not working in sed command. is there any other command to do this reply soon (5 Replies)
Discussion started by: kamesh83
5 Replies

3. Shell Programming and Scripting

Compare and print out data only appear in file 1 problem

Below is the data content of file_1 and file_2: file_1 >sample_1 FKGJGPOPOPOQA ASDADWEEWERE ASDAWEWQWRW ASDASDASDASDD file_2 >sample_1 DRTOWPFPOPOQA ASDADWEEASDF ASDADRTYWRW ASDASDASDASDD I got try the following perl script. Unfortunately, it can't give my desired output result... (7 Replies)
Discussion started by: patrick87
7 Replies

4. Shell Programming and Scripting

Compare a file with all others then print off data

my script so far nawk -F, 'NR==FNR{a++;next} a{b++} END{for(i in b){if(b-1){print i";\t\t"b}else{print "NEW:"i";\t\t1"} } }' OFS=, 20111228.csv *.csv | sort NE:221478,SHELF:13,SLOT:4; 2 NE:221726,SHELF:8,SLOT:1; 2 NE:222318,SHELF:14,SLOT:1; 9... (20 Replies)
Discussion started by: llcooljatt
20 Replies

5. Shell Programming and Scripting

How to combine data from 2 file ? How to print ?

Dear friends, I am just trying to print data from 2 file,namely file_1.txt and file_1.dat (specific column of ROW 1) file_1.txt 12 13 14 15 99 AMC 69 36 89 12 13 14 15 99 AMC 69 84 -12 12 13 14 ... (6 Replies)
Discussion started by: nex_asp
6 Replies

6. Shell Programming and Scripting

Use PYTHON to collect data weather and print in new file

Hi all, i have a task to do with Python and because i'm a beginner on it i would like your help on this. Create a python script that: Every hour collect the Temperature (e.g. 29C) and Current Condition (e.g. Clear) from this website wunderground.com/global/stations/54511.html Create a CSV... (0 Replies)
Discussion started by: ragaga123
0 Replies

7. UNIX for Dummies Questions & Answers

Print result of mv -n

I am trying to move files which donot have same filename using find /Users/ParijatMac/desktop/unix/new_dir -type f -mmin +"$HRS" -exec mv -n "{}" /Users/ParijatMac/desktop/unix/old_dir \; -print but i am getting all filenames including the ones with duplicate names.Please help me to sort... (5 Replies)
Discussion started by: parijat guh
5 Replies

8. Shell Programming and Scripting

awk parse result that match data from file

i run command that return this result,example : gigabitethernet2/2/4:NotPresent, gigabitethernet2/1/17:UP, gigabitethernet2/1/10:UP, gigabitethernet2/1/5:UP, gigabitethernet2/1/9:UP, gigabitethernet2/1/36:DOWN, gigabitethernet2/1/33:DOWN, gigabitethernet2/1/8:UP,... (19 Replies)
Discussion started by: wanttolearn1
19 Replies

9. Shell Programming and Scripting

Compare 2 columns from the same file and print a value depending on the result

Hello Unix gurus, I have a file with this format (example values): label1 1 0 label2 1 0 label3 0.4 0.6 label4 0.5 0.5 label5 0.1 0.9 label6 0.9 0.1 in which: column 1 is a row label column 2 and 3 are values I would like to do a simple operation on this table and get the... (8 Replies)
Discussion started by: ksennin
8 Replies

10. Shell Programming and Scripting

To get or print specific value in result

i am executing below code to achive my result, but for second row the value is not coming it should come URL like other two . url start with http:// and end with .xhtml cat FILE | grep 'Test failed' | awk -F',' '{print $3,$8,$12}' INPUT 1517679173303,84,SKILLED LANGUAGE - ENTER... (11 Replies)
Discussion started by: mirwasim
11 Replies
KVM_GETPCPU(3)						   BSD Library Functions Manual 					    KVM_GETPCPU(3)

NAME
kvm_dpcpu_setcpu kvm_getmaxcpu, kvm_getpcpu -- access per-CPU data LIBRARY
Kernel Data Access Library (libkvm, -lkvm) SYNOPSIS
#include <sys/param.h> #include <sys/pcpu.h> #include <sys/sysctl.h> #include <kvm.h> int kvm_dpcpu_setcpu(kvm_t *kd, u_int cpu); int kvm_getmaxcpu(kvm_t *kd); int kvm_getncpus(kvm_t *kd); void * kvm_getpcpu(kvm_t *kd, int cpu); ssize_t kvm_read_zpcpu(kvm_t *kd, u_long base, void *buf, size_t size, int cpu); uint64_t kvm_counter_u64_fetch(kvm_t *kd, u_long base); DESCRIPTION
The kvm_dpcpu_setcpu(), kvm_getmaxcpu(), and kvm_getpcpu() functions are used to access the per-CPU data of active processors in the kernel indicated by kd. Per-CPU storage comes in two flavours: data stored directly in a struct pcpu associated with each CPU, and dynamic per-CPU storage (DPCPU), in which a single kernel symbol refers to different data depending on what CPU it is accessed from. The kvm_getmaxcpu() function returns the maximum number of CPUs supported by the kernel. The kvm_getncpus() function returns the current number of CPUs in the kernel. The kvm_getpcpu() function returns a buffer holding the per-CPU data for a single CPU. This buffer is described by the struct pcpu type. The caller is responsible for releasing the buffer via a call to free(3) when it is no longer needed. If cpu is not active, then NULL is returned instead. The kvm_read_zpcpu() function is used to obtain private per-CPU copy from a UMA_ZONE_PCPU zone(9). It takes base argument as base address of an allocation and copyies size bytes into buf from the part of allocation that is private to cpu. The kvm_counter_u64_fetch() function fetches value of a counter(9) pointed by base address. Symbols for dynamic per-CPU data are accessed via kvm_nlist(3) as with other symbols. libkvm maintains a notion of the "current CPU", set by kvm_dpcpu_setcpu, which defaults to 0. Once another CPU is selected, kvm_nlist(3) will return pointers to that data on the appropriate CPU. CACHING
kvm_getmaxcpu() and kvm_getpcpu() cache the nlist values for various kernel variables which are reused in successive calls. You may call either function with kd set to NULL to clear this cache. RETURN VALUES
On success, the kvm_getmaxcpu() function returns the maximum number of CPUs supported by the kernel. If an error occurs, it returns -1 instead. On success, the kvm_getpcpu() function returns a pointer to an allocated buffer or NULL. If an error occurs, it returns -1 instead. On success, the kvm_dpcpu_setcpu() call returns 0; if an error occurs, it returns -1 instead. On success, the kvm_read_zpcpu() function returns number of bytes copied. If an error occurs, it returns -1 instead. If any function encounters an error, then an error message may be retrieved via kvm_geterr(3). SEE ALSO
free(3), kvm(3), counter(9), zone(9) BSD
February 12, 2014 BSD
All times are GMT -4. The time now is 02:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy