process on file


 
Thread Tools Search this Thread
Top Forums Programming process on file
# 1  
Old 06-20-2004
process on file

Hello,

I need to write this C program:

MyProgram <user>

that write on myfile.txt file all <users> 'process.

MyProgram must call the ps -u <user> command, but with an exec or with a system?

can any one help me?

Thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Monitoring processes in parallel and process log file after process exits

I am writing a script to kick off a process to gather logs on multiple nodes in parallel using "&". These processes create individual log files. Which I would like to filter and convert in CSV format after they are complete. I am facing following issues: 1. Monitor all Processes parallelly.... (5 Replies)
Discussion started by: shunya
5 Replies

2. Shell Programming and Scripting

Ksh: How to write the log file simultaneously when .sql file executes by UNIX process

Hello Team- we would like to implement an approach which has to write the log file simultaneously when .sql file is executing by Unix process. At present,it is writing the log file once the process is completed. I've tested the current process with the below approaches and none of them... (1 Reply)
Discussion started by: Hima_B
1 Replies

3. UNIX for Advanced & Expert Users

How to copy a binary file while the file is being written to by another process

Hello, Can I copy a binary file while the file is being written to by another process? Another process (program) “P1” creates and opens (for writing) binary file “ABC” on local disk. Process P1 continuously write into ABC file every couple of seconds, adding 512-byte blocks of data. ABC file... (1 Reply)
Discussion started by: mbuki
1 Replies

4. Shell Programming and Scripting

SFTP Process each File!

Hi All, I'm a newbie here in unix. I'm just wondering how can i process each file while in sftp? is it possible? Ex. server1 1.txt 2.txt how can i get the top of the file and process it. output: 1.txt is going to process because it's in the top. i can't figure out how to do it. T_T... (9 Replies)
Discussion started by: nikki1200
9 Replies

5. Shell Programming and Scripting

awk: process file

Hello, i have a file as below: ... AAA: 1 BBB: 2 CCC: 3 AAA: 11 BBB: 22 CCC: 33 AAA: 111 BBB: 222 CCC: 333 .... how to process it by using AWK to this: (AAA BBB CCC) .... 1 11 111 2 22 222 3 33 333 (2 Replies)
Discussion started by: 0916981
2 Replies

6. Shell Programming and Scripting

Check if file is loaded completely and then process the file

I need to write a script which checks for files loaded into a folder (files are loaded by ftp from other server) and process the file only if the file is loaded completely. if the file is not complete in the current run, it must be processed in the next run. Any suggestions would be welcome... (2 Replies)
Discussion started by: kalyan381
2 Replies

7. Shell Programming and Scripting

Read from file > process > output to file

Hi all, OK, I am totally new to shell scripting as I just started today. All I want from shell scripting is something very basic, and I've been searching for tutorials on "processing files" and I could not find a suitable one for my level. I want to read two columns from a data file, one raw... (3 Replies)
Discussion started by: Lorna
3 Replies

8. AIX

process the old file first

hello i have direcotry in which i will be getting a number of input files with different names and i need to write a script where i need to process the older file first and then come out of the loop. can any one throw some light appreciate (2 Replies)
Discussion started by: dsdev_123
2 Replies

9. Shell Programming and Scripting

Process all file

I have several file in the directory. I try to run a encrypt script but one file processed only. data_files='Ma*.txt' for file in $data_files do java Encrypt key.txt $data_files done How i can process all the file? (2 Replies)
Discussion started by: nazri76
2 Replies
Login or Register to Ask a Question
FCNTL(2)							System Calls Manual							  FCNTL(2)

NAME
fcntl - file control SYNOPSIS
#include <fcntl.h> res = fcntl(fd, cmd, arg) int res; int fd, cmd, arg; DESCRIPTION
Fcntl provides for control over descriptors. The argument fd is a descriptor to be operated on by cmd as follows: F_DUPFD Return a new descriptor as follows: Lowest numbered available descriptor greater than or equal to arg. Same object references as the original descriptor. New descriptor shares the same file pointer if the object was a file. Same access mode (read, write or read/write). Same file status flags (i.e., both file descriptors share the same file status flags). The close-on-exec flag associated with the new file descriptor is set to remain open across execv(2) system calls. F_GETFD Get the close-on-exec flag associated with the file descriptor fd. If the low-order bit is 0, the file will remain open across exec, otherwise the file will be closed upon execution of exec. F_SETFD Set the close-on-exec flag associated with fd to the low order bit of arg (0 or 1 as above). F_GETFL Get descriptor status flags, as described below. F_SETFL Set descriptor status flags. F_GETOWN Get the process ID or process group currently receiving SIGIO and SIGURG signals; process groups are returned as negative values. F_SETOWN Set the process or process group to receive SIGIO and SIGURG signals; process groups are specified by supplying arg as nega- tive, otherwise arg is interpreted as a process ID. The flags for the F_GETFL and F_SETFL flags are as follows: O_NONBLOCK Non-blocking I/O; if no data is available to a read call, or if a write operation would block, the call returns -1 with the error EWOULDBLOCK. O_APPEND Force each write to append at the end of file; corresponds to the O_APPEND flag of open(2). O_ASYNC Enable the SIGIO signal to be sent to the process group when I/O is possible, e.g., upon availability of data to be read. RETURN VALUE
Upon successful completion, the value returned depends on cmd as follows: F_DUPFD A new file descriptor. F_GETFD Value of flag (only the low-order bit is defined). F_GETFL Value of flags. F_GETOWN Value of file descriptor owner. other Value other than -1. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
Fcntl will fail if one or more of the following are true: [EBADF] Fildes is not a valid open file descriptor. [EMFILE] Cmd is F_DUPFD and the maximum allowed number of file descriptors are currently open. [EINVAL] Cmd is F_DUPFD and arg is negative or greater than the maximum allowable number (see getdtablesize(2)). [ESRCH] Cmd is F_SETOWN and the process ID given as argument is not in use. SEE ALSO
close(2), execve(2), getdtablesize(2), open(2), sigvec(2) BUGS
The asynchronous I/O facilities of O_NONBLOCK and O_ASYNC are currently available only for tty and socket operations. 4.2 Berkeley Distribution Nov 30, 1994 FCNTL(2)