Sponsored Content
Full Discussion: Removing header and footer
Top Forums Shell Programming and Scripting Removing header and footer Post 302605356 by Tom Sawyer on Wednesday 7th of March 2012 10:00:41 AM
Old 03-07-2012
Removing header and footer

I have two files which are getting sent to a UNIX server in order to be bcp'd into a database. The bcp is failing because there's a header and footer row on the file which give the date of the file and the number of rows in it. That's because the file is also being used for another process, so we can't change it being created like that.

The file is delimited by !, so I need to either add a bunch of exclamation points to the header and footer lines so they'll go in without causing the bcp to fail and I can just delete them at a database level or remove the header and footer lines.

The formats are:

header: T_ACCEL_20120301 (that's the date)
footer: T_ACCEL_588263 (that's the number of records)

Apparently there's something which can be done with an SED command which will remove these lines since they're always the first and last lines in the file, but my google-fu has failed me and my attempts to do this just meet with random errors. Can anyone help me out?

Edit: I've gotten the header solved but can't seem to remove the footer.

Last edited by Tom Sawyer; 03-07-2012 at 11:14 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove header and footer rows

I would like to remove some lines from begining of file (header) and some lines from end of file (footer). The header/footer lines generated by web-browser when the user upload a file to my webserver. Example: -----------------------------7d62af20c052c Content-Disposition: form-data;... (2 Replies)
Discussion started by: seaky
2 Replies

2. Shell Programming and Scripting

Inserting Header and footer

Hi All, I have several txt files i need to enter specific header and footer (both are separate) to all these files how can i do this? plz help.. Regards, Raghav (4 Replies)
Discussion started by: digitalrg
4 Replies

3. Shell Programming and Scripting

How to add header and footer?

Hi, Guys, I want add header and footer in a file. I can add footer using following command: echo "Footer" >>file. I don't know how to add header. Thanks in advance (4 Replies)
Discussion started by: ken002
4 Replies

4. UNIX for Dummies Questions & Answers

Help with the Header and Footer check

Hi, I need to check whether the incoming file has a header and footer using a UNIX script. The pattern of the header and footer is fixed as follows: Header: Name,Date Footer: Count, Total Name,Date ------------------------- ------------------------- ------------------------- Count,... (5 Replies)
Discussion started by: Sunny_teotia
5 Replies

5. UNIX for Dummies Questions & Answers

remove the header and footer using sed

I want to delete the header and footer in the file by using sed for that i ran the below script and my text file looks like emp.txt # This file contain employee # information abc 12300 34 'FGH' # This is confidential as per the firm rules. my intention is to remove the header... (8 Replies)
Discussion started by: vmachava
8 Replies

6. Shell Programming and Scripting

Header and Footer...

Hi All, I need to write a script that In my file I have to check header and footer records are available or not. If it is available I have to run the script, otherwise I should not. But current script it is checking only the data inside the script. It is avoiding to check Header and Footer... (1 Reply)
Discussion started by: suresh_target
1 Replies

7. Shell Programming and Scripting

Add header and footer with record count in footer

This is my file(Target.txt) name|age|locaction abc|23|del xyz|24|mum jkl|25|kol The file should be like this 1|03252012 1|name|age|location 2|abc|23|del 2|xyz|24|mum 2|jkl|25|kol 2|kkk|26|hyd 3|4 Column 1 is row indicator for row 1 and 2, column indicator is 1,for data rows... (1 Reply)
Discussion started by: itsranjan
1 Replies

8. Shell Programming and Scripting

Removing header or footer from file

Hi Every one, what is the coomand to remove header or footer from a file. Please help me by providing command/syntax to remove header/footer from unix. Thanks in advance for all your support. (5 Replies)
Discussion started by: sridhardwh
5 Replies

9. Shell Programming and Scripting

Is there a way to append both at header and footer of a file

currently I've a file Insert into CD_CARD_TYPE (CODE, DESCRIPTION, LAST_UPDATE_BY, LAST_UPDATE_DATE) Values ('024', '024', 2, sysdate); Insert into CD_CARD_TYPE (CODE, DESCRIPTION, LAST_UPDATE_BY, LAST_UPDATE_DATE) Values ('032', '032', 2, sysdate); ........ is it... (3 Replies)
Discussion started by: jediwannabe
3 Replies

10. Shell Programming and Scripting

Strip header and footer

Hi I have below requirements on the script below : (1) I receive 2 pipe seperated file called OUT.psv and DIFF.psv with a column header.I concatenate the 2 files and create a final.psv file. I want to add another header as START_FILE to the final.psv file . How to achieve this ? (2) I have... (5 Replies)
Discussion started by: samrat dutta
5 Replies
AMPLE.HTML(5)							    User Manual 						     AMPLE.HTML(5)

NAME
ample.html - html template for Ample DESCRIPTION
This file, by default /etc/ample/ample.html, is read by Ample at startup and used as a base for it's HTML pages. These pages are rendered whenever a webbrowser connects and requests a list of available songs and directories (typically done by connecting to http://server:port/index.html). The file is divided into three sections, the header, the middle and the footer. The header and the footer are the same on each page gener- ated while the "middle" is copied into the final HTML document once for each file or directory that is going to be listed. Although this may sound confusing, it will probably become much more evident once you look at the example below. Variables are written in uppercase and enclosed within "at" signs (example: @NAME@) and are replaced dynamically when the page is con- structed. Some variables can exist anywhere in the document and some can only exist in the "middle" section, see the information about each variable for details. EXAMPLE
<!-- Beginning of header --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head> <title>@SERVERNAME@</title> </head><body> <center> <p><h1>@SERVERNAME@</h1></p> <p><h2>Tracks currently available in @PATH@</h2></p> <p><font size="-1">[ <a href="index.m3u">playlist for this dir</a> | <a href="rindex.m3u">recursive playlist</a> ] </font></p> <p><font size="-1"> [ <a href="../index.html">Up one level</a> ] </font></p> <div align="center"> <table border="1" cellspacing="0" cellpadding="0" bordercolor="#000000"> <tr><td> <b>TYPE</b> </td><td> <b>URL</b> </td></tr> <!-- End of header --> @BEGIN@ <!-- Beginning of "middle" --> <tr><td> @TYPE@ </td><td> <a href="@URL@">@NAME@</a> </td></tr> <!-- End of "middle" --> @END@ <!-- Beginning of footer --> </table> </div> <p align="right"><font size="-1"> powered by Ample, for more information, see the <a href="http://ample.sourceforge.net">project homepage</a> </font></p> </center> </body> </html> <!-- End of footer --> SUMMARY OF VARIABLES
SPECIAL - Only used once BEGIN END GLOBAL - Can be used anywhere SERVERNAME PORT PATH NON-GLOBAL - Can only be used in the "middle" section NAME URL LENGTH TITLE SIZE TYPE SPECIAL VARIABLES
These can only be used once. BEGIN This variable (when placed in the beginning of a new line) marks the end of the header section and the start of the "middle" sec- tion. END This variable (when placed in the beginning of a new line) marks the end of the "middle" section and the start of the footer sec- tion. GLOBAL VARIABLES
These can be used anywhere. SERVERNAME The name of the server as given in ample.conf(5). PORT The port that the server is listening to. PATH The current path the user is viewing. NON-GLOBAL VARIABLES These can only be used in the "middle" section. NAME The name of the song or directory. URL The URL of the song or directory. LENGTH The song length (in seconds) or blank if it is a directory. TITLE The title of the song or "DIR" if it is a directory. SIZE The file size or blank if it is a directory. TYPE "FILE" if it is a file or "DIR" if it is a directory. AUTHOR
David Hardeman <david@2gen.com> SEE ALSO
ample(1), ample.conf(5) Ample JANUARY 2002 AMPLE.HTML(5)
All times are GMT -4. The time now is 04:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy