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_ia_close(3DAT)				     Direct Access Transport Library Functions					dat_ia_close(3DAT)

NAME
dat_ia_close - close an IA SYNOPSIS
cc [ flag... ] file... -ldat [ library... ] #include <dat/udat.h> DAT_RETURN dat_ia_close ( IN DAT_IA_HANDLE ia_handle, IN DAT_CLOSE_FLAGS ia_flags ) PARAMETERS
ia_handle Handle for an instance of a DAT IA. ia_flags Flags for IA closure. Flag definitions are: DAT_CLOSE_ABRUPT_FLAG Abrupt close. Abrupt cascading close of IA including all Consumer created DAT objects. DAT_CLOSE_GRACEFUL_FLAG Graceful close. Closure is successful only if all DAT objects created by the Consumer have been freed before the grace- ful closure call. Default value of DAT_CLOSE_DEFAULT = DAT_CLOSE_ABRUPT_FLAG represents abrupt closure of IA. DESCRIPTION
The dat_ia_close() function closes an IA (destroys an instance of the Interface Adapter). The ia_flags specify whether the Consumer wants abrupt or graceful close. The abrupt close does a phased, cascading destroy. All DAT Objects associated with an IA instance are destroyed. These include all the con- nection oriented Objects: public and reserved Service Points; Endpoints, Connection Requests, LMRs (including lmr_contexts), RMRs (includ- ing rmr_contexts), Event Dispatchers, CNOs, and Protection Zones. All the waiters on all CNOs, including the OS Wait Proxy Agents, are unblocked with the DAT_HANDLE_NULL handle returns for an unblocking EVD. All direct waiters on all EVDs are also unblocked and return with DAT_ABORT. The graceful close does a destroy only if the Consumer has done a cleanup of all DAT objects created by the Consumer with the exception of the asynchronous EVD. Otherwise, the operation does not destroy the IA instance and returns the DAT_INVALID_STATE. If async EVD was created as part of the of dat_ia_open(3DAT), dat_ia_close() must destroy it. If async_evd_handle was passed in by the Con- sumer at dat_ia_open(), this handle is not destroyed. This is applicable to both abrupt and graceful ia_flags values. Because the Consumer did not create async EVD explicitly, the Consumer does not need to destroy it for graceful close to succeed. RETURN VALUES
DAT_SUCCESS The operation was successful. DAT_INSUFFICIENT_RESOURCES The operation failed due to resource limitations. This is a catastrophic error. DAT_INVALID_HANDLE Invalid DAT handle; ia_handle is invalid. DAT_INVALID_PARAMETER Invalid parameter; ia_flags is invalid. DAT_INVALID_STATE Parameter in an invalid state. IA instance has Consumer-created objects associated with it. USAGE
The dat_ia_close() function is the root cleanup method for the Provider, and, thus, all Objects. Consumers are advised to explicitly destroy all Objects they created prior to closing the IA instance, but can use this function to clean up everything associated with an open instance of IA. This allows the Consumer to clean up in case of errors. Note that an abrupt close implies destruction of EVDs and CNOs. Just as with explicit destruction of an EVD or CNO, the Consumer should take care to avoid a race condition where a Consumer ends up attempting to wait on an EVD or CNO that has just been deleted. The techniques described in dat_cno_free(3DAT) and dat_evd_free(3DAT) can be used for these purposes. If the Consumer desires to shut down the IA as quickly as possible, the Consumer can call dat_ia_close(abrupt) without unblocking CNO and EVD waiters in an orderly fashion. There is a slight chance that an invalidated DAT handle will cause a memory fault for a waiter. But this might be an acceptable behavior, especially if the Consumer is shutting down the process. No provision is made for blocking on event completion or pulling events from queues. This is the general cleanup and last resort method for Consumer recovery. An implementation must provide for successful completion under all conditions, avoiding hidden resource leakage (dangling memory, zombie processes, and so on) eventually leading to a reboot of the oper- ating system. The dat_ia_close() function deletes all Objects that were created using the IA handle. The dat_ia_close() function can decrement a reference count for the Provider Library that is incremented by dat_ia_open() to ensure that the Provider Library cannot be removed when it is in use by a DAT Consumer. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard: uDAPL, 1.1, 1.2 | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
dat_cno_free(3DAT), dat_evd_free(3DAT), dat_ia_open(3DAT), libdat(3LIB), attributes(5) SunOS 5.10 16 Jul 2004 dat_ia_close(3DAT)
All times are GMT -4. The time now is 09:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy