Sponsored Content
Full Discussion: Header as is.. trailer count
Top Forums Shell Programming and Scripting Header as is.. trailer count Post 302365699 by cfajohnson on Tuesday 27th of October 2009 09:20:43 PM
Old 10-27-2009

Code:
awk '
  NR == 1 { print; next }
  NF == 1 { exit }
  !x[$1]++ { print; ++total }
END { printf "3%07d\n", total }
' "$file"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count No of Records in File without counting Header and Trailer Records

I have a flat file and need to count no of records in the file less the header and the trailer record. I would appreciate any and all asistance Thanks Hadi Lalani (2 Replies)
Discussion started by: guiguy
2 Replies

2. UNIX for Dummies Questions & Answers

Checking the header and trailer for a given string and if not found, exit out of the

hi, How to check a given file for a string and if it's not found, exit out ofthe script? e.g. a file Test123 is there whose header begins with #bt and trailer begins with #ed. I have to check if the header and trailer matches as above and if not, exit out of the script. How can we do it in... (2 Replies)
Discussion started by: er_ashu
2 Replies

3. UNIX for Dummies Questions & Answers

Append Header and Trailer

Hi everyone, I am new to Unix programming. My inquries is:- a) How to add a Header and Trailer in the set of data b) Include a number count of the data in the trailer The set of data only contained the information of 'Customer's Name' and 'Account Number'. I would like to add the Header... (2 Replies)
Discussion started by: balzzz
2 Replies

4. Shell Programming and Scripting

Removing Header & Trailer from a file

Hi All, I am karthik. I am new to this forum. I have one requirement. I have a file with header and footer. Header may be like HDR0001 or FILE20090110 (Assume it is unknown so far, but i am sure there is a header in the file) likewise file has the trailer too. I just... (7 Replies)
Discussion started by: karthi_gana
7 Replies

5. UNIX for Dummies Questions & Answers

Adding header and trailer into a file

Hi, I want to add the below Header to all the files in sequence File1,File2,File3...etc "ABC,<number of chracter in the file>" e,g - If File1 is as below pqrstuvdt abcdefgh then I want to add the above header into it ,So that File1 becomes as below ABC,17 pqrstuvdt abcdefgh ... (9 Replies)
Discussion started by: spari2
9 Replies

6. UNIX for Dummies Questions & Answers

oneliner for adding header and trailer

for example, i have a file with below content: 123413 866688 816866 818818 i want the output as: This is header 123413 866688 816866 818818 This is trailer i am able to achieve it using a bash script. (2 Replies)
Discussion started by: pandeesh
2 Replies

7. Shell Programming and Scripting

Script to validate file header and trailer

Hi, I need a script that validates a file header/detail/trailer. File layout is: Header - Rec_Type|File_name|File_Date Detail - Rec_Type|field1|field2|field3... Trailder - Rec_Type|File_name|File_Date|Record_count Sample Data: HDR|customer_data.dat|20120709... (7 Replies)
Discussion started by: ash_sh
7 Replies

8. Shell Programming and Scripting

Verify the header and trailer in file

please see my requirement, I hope I am clear. (9 Replies)
Discussion started by: mirwasim
9 Replies

9. Shell Programming and Scripting

Sort without Header and Trailer

Hi , My UNIX system is SUN Solaris. I am trying to do a simple thing as described below. I have a PIPE delimited file that has header and trailer. So the file is something like below: Test1.txt looks like something below: field_data1|field_data2|and some more data --Header ... (5 Replies)
Discussion started by: Saanvi1
5 Replies

10. UNIX for Beginners Questions & Answers

Header and trailer Check in UNIX

I am planning to automate multiple files through Unix script. Could you please guide for making the automation for multiple files ? Eg. I have to check header and footer for all files in the particular path and the header pattern should match with the filename. Filename- Filename.txt... (2 Replies)
Discussion started by: karthick2020333
2 Replies
dat_rsp_create(3DAT)				     Direct Access Transport Library Functions				      dat_rsp_create(3DAT)

NAME
dat_rsp_create - create a Reserved Service Point SYNOPSIS
cc [ flag... ] file... -ldat [ library... ] #include <dat/udat.h> DAT_RETURN dat_rsp_create ( IN DAT_IA_HANDLE ia_handle, IN DAT_CONN_QUAL conn_qual, IN DAT_EP_HANDLE ep_handle, IN DAT_EVD_HANDLE evd_handle, OUT DAT_RSP_HANDLE *rsp_handle ) PARAMETERS
ia_handle Handle for an instance of DAT IA. conn_qual Connection Qualifier of the IA the Reserved Service Point listens to. ep_handle Handle for the Endpoint associated with the Reserved Service Point that is the only Endpoint that can accept a Connection Request on this Service Point. The value DAT_HANDLE_NULL requests the Provider to associate a Provider-created Endpoint with this Service Point. evd_handle The Event Dispatcher to which an event of Connection Request arrival is generated. rsp_handle Handle to an opaque Reserved Service Point. DESCRIPTION
The dat_rsp_create() function creates a Reserved Service Point with the specified Endpoint that generates, at most, one Connection Request that is delivered to the specified Event Dispatcher in a Notification event. RETURN VALUES
DAT_SUCCESS The operation was successful. DAT_INSUFFICIENT_RESOURCES The operation failed due to resource limitations. DAT_INVALID_HANDLE The ia_handle, evd_handle, or ep_handle parameter is invalid. DAT_INVALID_PARAMETER The conn_qual parameter is invalid. DAT_INVALID_STATE Parameter in an invalid state. For example, an Endpoint was not in the Idle state. DAT_CONN_QUAL_IN_USE Specified Connection Qualifier is in use. USAGE
The usage of a Reserve Service Point is as follows: o The DAT Consumer creates a Local Endpoint and configures it appropriately. o The DAT Consumer creates a Reserved Service Point specifying the Local Endpoint. o The Reserved Service Point performs the following: o Collects native transport information reflecting a received Connection Request. o Creates a Pending Connection Request. o Creates a Connection Request Notice (event) that includes the Pending Connection Request (which includes, among others, Reserved Service Point Connection Qualifier, its Local Endpoint, and information about remote Endpoint). o Delivers the Connection Request Notice to the Consumer-specified target (CNO) evd_handle. The Local Endpoint is transitioned from Reserved to Passive Connection Pending state. o Upon receiving a connection request, or at some time subsequent to that, the DAT Consumer must either accept() or reject() the Pending Connection Request. o If accepted, the original Local Endpoint is now in a Connected state and fully usable for this connection, pending only native transport mandated RTU messages. This includes binding it to the IA port if that was not done previously. The Consumer is noti- fied that the Endpoint is in a Connected state by a Connection Established Event on the Endpoint connect_evd_handle. o If rejected, the Local Endpoint point transitions into Unconnected state. The DAT Consumer can elect to destroy it or reuse it for other purposes. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard: uDAPL, 1.1, 1.2 | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
libdat(3LIB), attributes(5) SunOS 5.11 16 Jul 2004 dat_rsp_create(3DAT)
All times are GMT -4. The time now is 12:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy