How Do I Add a Header and Trailer in Unix?
Contents How Do I Add a Header in Unix? to Update the Original File Itself, Use the -I Option of Sed. to Add a Header Record to a File Using Awk: $ Awk...
Contents
How do I add a header in Unix?
To update the original file itself, use the -i option of sed.
- To add a header record to a file using awk: $ awk ‘BEGIN{print “FRUITS”}1’ file1. FRUITS. …
- To add a trailer record to a file using sed: $ sed ‘$a END OF FRUITS’ file1 apple. …
- To add a trailer record to a file using awk: $ awk ‘1;END{print “END OF FRUITS”}’ file.
28 мар. 2011 г.
What is header and trailer in file?
The header record contains information to identify the data in the file and the length of the data records. The trailer record contains a record count of the actual number of data records, not including the header and trailer records, in the file.