Sponsored Content
Top Forums Shell Programming and Scripting Count No of Records in File without counting Header and Trailer Records Post 302120660 by Shell_Life on Thursday 7th of June 2007 11:39:29 AM
Old 06-07-2007
Guiguy,
Please, include all relevant information, such as a sample of
the file and tell us what is "header" and what is "trailer", so
that we may be able to help you.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep all records in a file and get a word count -perl

Hi, I have a file .. file.txt .. i need to get a total record count in the files into a $variable.. im using perl script thanks (4 Replies)
Discussion started by: meghana
4 Replies

2. UNIX for Dummies Questions & Answers

Count records in a zip file

Hello, I searched the forums on the keywords in the title I used above, but I did not find the answer: Is it possible to count records in a .zip file on an AIX machine if i don't have pkunzip installed? From all the research I'm reading in google and the reading of pkunzip in Unix.com,... (3 Replies)
Discussion started by: tekster757
3 Replies

3. Shell Programming and Scripting

Merge text files while combining the multiple header/trailer records into one each.

Situation: Our system currently executes a job (COBOL Program) that generates an interface file to be sent to one of our vendors. Because this system processes information for over 100,000 employees/retirees (and growing), we'd like to multi-thread the job into processing-groups in order to... (4 Replies)
Discussion started by: oordonez
4 Replies

4. Shell Programming and Scripting

Help me in counting records from file

Hi, Please help me in counting the below records(1st field) from samplefile: Expected output: Count Descr ------------------------------------------- 7 Mean manager 14 ... (7 Replies)
Discussion started by: prashant43
7 Replies

5. Shell Programming and Scripting

Header as is.. trailer count

i have .DAT file FILE1.DAT 1200910270040625 2123456789 J123456 ABC 2123456789 K123456 ABC 2222222222 L123456 DEF 2333333333 M12345 GHI 30000004 My outfile FILE2.TXT should have like this, I need the header value as ie (1200910270040625 ) body rows remove the duplicate rows and the... (2 Replies)
Discussion started by: kshuser
2 Replies

6. Shell Programming and Scripting

improve performance - replace $\| with $#@ and remove header and trailer records

Hi All, In my file i need to remove header and trailer records which comes in 1st line and last line respectively. After that i need to replace '$\|' with '$#@'. I am using sed command for this and its taking lot of time. Is there any other command which can be used to improve performance? ... (1 Reply)
Discussion started by: HemaV
1 Replies

7. UNIX for Dummies Questions & Answers

Grep specific records from a file of records that are separated by an empty line

Hi everyone. I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this: ID: 20 Name: X Age: 19 ID: 21 Name: Z ID: 22 Email: xxx@yahoo.com Name: Y Age: 19 I want to grep records that... (4 Replies)
Discussion started by: Atrisa
4 Replies

8. Shell Programming and Scripting

Adding Header and Trailer records to a appended file

How can we a shell script and pass date parameters .I have 3 files comming from Datastage with |" delimited I need append 3 files as above: File1: P0000|"47416954|"AU|"000|"INS|"0000|"|"20060601|"99991231|"|"|"|"|"01 File 2:... (2 Replies)
Discussion started by: e1994264
2 Replies

9. Shell Programming and Scripting

How to count dup records in file?

Hi Gurus, I need to count the duplicate records in file file abc abc def ghi ghi jkl I want to get below result: abc ,2 abc, 2 def ,1 ghi ,2 ghi, 2 jkl ,1 or abc ,2 def ,1 (3 Replies)
Discussion started by: ken6503
3 Replies

10. Shell Programming and Scripting

Separate records of a file on 2 types of records

Hi I am new to shell programming in unix Please if I can provide help. I have a file structure of a header record and "N" detail records. The header record will be the total number of detail records I need to split the file in 2: One for the header Another for all detail records Could... (1 Reply)
Discussion started by: jamcogar
1 Replies
SENDFILE(2)						      BSD System Calls Manual						       SENDFILE(2)

NAME
sendfile -- send a file to a socket SYNOPSIS
#include <sys/types.h> #include <sys/socket.h> #include <sys/uio.h> int sendfile(int fd, int s, off_t offset, off_t *len, struct sf_hdtr *hdtr, int flags); DESCRIPTION
The sendfile() system call sends a regular file specified by descriptor fd out a stream socket specified by descriptor s. The offset argument specifies where to begin in the file. Should offset fall beyond the end of file, the system will return success and report 0 bytes sent as described below. The len argument is a value-result parameter, that specifies how many bytes of the file should be sent and/or how many bytes have been sent. Initially the value pointed to by the len argument specifies how many bytes should be sent with 0 having the special meaning to send until the end of file has been reached. On return the value pointed to by the len argument indicates how many bytes have been sent, except when a header or trailer is specified as shown below. The len pointer may not be NULL. An optional header and/or trailer can be sent before and after the file data by specifying a pointer to a struct sf_hdtr, which has the fol- lowing structure: struct sf_hdtr { struct iovec *headers; /* pointer to header iovecs */ int hdr_cnt; /* number of header iovecs */ struct iovec *trailers; /* pointer to trailer iovecs */ int trl_cnt; /* number of trailer iovecs */ }; The headers and trailers pointers, if non-NULL, point to arrays of struct iovec structures. See the writev() system call for information on the iovec structure. The number of iovecs in these arrays is specified by hdr_cnt and trl_cnt. When a header or trailer is specified, the value of len argument indicates the maximum number of bytes in the header and/or file to be sent. It does not control the trailer; if a trailer exists, all of it will be sent. If the value of len argument is 0, all of the header and/or file will be sent before the entire trailer is sent. On return, the len argument specifies the total number of bytes sent. The flags parameter is reserved for future expansion and must be set to 0. Any other value will cause sendfile() to return EINVAL. When using a socket marked for non-blocking I/O, sendfile() may send fewer bytes than requested. In this case, the number of bytes success- fully sent is returned in the via the len parameters and the error EAGAIN is returned. When a signal causes sendfile() to return the error EINTR, the len argument may return 0 without necessarily meaning the end of file has been reached as the signal may have been caught before any data was sent. IMPLEMENTATION NOTES
The Mac OS X implementation of sendfile() uses 64 bits types for size and offset parameters so there is no need for a 64 bits version sendfile64() as found on some other operating systems. RETURN VALUES
The sendfile() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indi- cate the error. The number of bytes sent is returned via the parameter len. A value of 0 means the end of the file specified by descriptor fd has been reached or that the value passed in offset falls beyond the end of file. ERRORS
[EAGAIN] The socket is marked for non-blocking I/O and not all data was sent due to the socket buffer being full. If specified, the number of bytes successfully sent will be returned in *len. [EBADF] The fd argument is not a valid file descriptor. [ENOTSUP] The fd argument does not refer to a regular file. [EBADF] The s argument is not a valid socket descriptor. [ENOTSOCK] The s argument does not refer stream oriented socket. [EFAULT] An invalid address was specified for an argument. [EINTR] A signal interrupted sendfile() before it could be completed. If specified, the number of bytes successfully sent will be returned in *len. [EINVAL] The offset argument is negative. [EINVAL] The len argument is NULL. [EINVAL] The flags argument is not set to 0. [EIO] An error occurred while reading from fd. [ENOTCONN] The s argument points to an unconnected socket. [ENOTSOCK] The s argument is not a socket. [EOPNOTSUPP] The file system for descriptor fd does not support sendfile(). [EPIPE] The socket peer has closed the connection. SEE ALSO
open(2), send(2), socket(2), writev(2) HISTORY
The sendfile() system call first appeared in Darwin 9.0 (Mac OS X version 10.5) . AUTHORS
This manual page is based on the FreeBSD version written by David G. Lawrence <dg@dglawrence.com> Mac OS X March 31, 2006 Mac OS X
All times are GMT -4. The time now is 08:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy