Help with the Header and Footer check


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help with the Header and Footer check
Prev   Next
# 6  
Old 06-06-2011
Code:
awk -F , 'NR==1{h1=$1;h2=$2}
         END{if (h1!~"Name"||h2!~"Date"||$1!~"Count"||$2!~"total") print "Reject: " FILENAME}' infile

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Programming

[solved] how to remove header and footer

it still display header and footer header SQL*Plus: Release 10.2.0.1.0 - Production on Mon Sep 24 13:41:51 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, Real... (0 Replies)
Discussion started by: ment0smintz
0 Replies

3. 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

4. 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

5. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: Tom Sawyer
1 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. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question
nl(1)							      General Commands Manual							     nl(1)

NAME
nl - Numbers lines in a file SYNOPSIS
nl [-b type] [-d delimiter1[delimiter2]] [-f type] [-h type] [-i number] [-l number] [-n format] [-p] [-s [separator]] [-vnumber] [-wnum- ber] [file] STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: nl: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Use the following options to change the default settings. Specifies which body section lines to number. The recognized types are as fol- lows: Numbers all lines. Number only non-empty lines. Does not number any lines. Numbers only those lines containing the specified pat- tern. The full range of regular expressions is supported for pattern. The default for type is t. Uses delimiter1 and delimiter2 as the delimiters for the start of a logical page section. The default characters are : (backslash followed by a colon). You can specify either one or two characters after the -d option. If you want to use a backslash as a delimiter, enter two back- slashes (\). If you specify only one character, it is used as start of a logical page, and the end delimiter remains the default. Specifies which logical page footer lines to number. The types recognized are the same as in -b type. The default for type is n. Specifies which logical page header lines to number. The types recognized are the same as in -b type. The default for type is n. Increments logical page line numbers by number. The default is 1. Counts number blank lines as 1. You must use one or more of the "-ba", "-fa", and "-ha" options with this option for it to be effective. For example, -l3 will only number the third adjacent blank. The default is 1. Specifies format as the line numbering format. Recognized formats are as fol- lows: Left justified, leading zeroes are suppressed. Right justified, leading zeroes are suppressed (default). Right justified, leading zeroes are kept. Ignores logical page delimiters (does not restart numbering). Separates text from line numbers with the separator string. The default value of separator is a tab character. [Tru64 UNIX] If you enter -s without an argument, there is no separation between the line number and its text. Sets the initial logical page line number to number. Specifies number as the number of digits in the line number. The default value of number is 6. OPERANDS
The path name of a file in which the lines are to be numbered. If file is not specified, standard input is used. DESCRIPTION
The nl command reads file (standard input by default), numbers the lines in the input, and writes the numbered lines to standard output. In the output, nl numbers the lines on the left, according to the options you specify on the command line. The input text must be written in logical pages. Each logical page has a header, a body, and a footer section (sections can be empty). Unless you use the -p option, nl resets the line numbers at the start of each logical page. You can set line numbering options indepen- dently for the header, body, and footer sections (for example, no numbering of header and footer lines while numbering text lines only in the body). Signal the start of logical page sections with lines in file that contain nothing but the following delimiter characters (assuming the default delimiters--see the description of the -d option): Line Contents Start of ::: Header :: Body : Footer You can name only one file on the command line. You can list the options and the file name in any order. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. EXAMPLES
To number only the nonblank lines, enter: nl chap1 This displays a numbered listing of chap1, numbering only the nonblank lines in the body sections. If chap1 contains no :: :, : :, or : delimiters, then the entire file is considered the body. To number all lines, enter: nl -ba chap1 This numbers all the lines in the body sections, including blank lines. This form of the nl command is adequate for most uses. To specify a different line number format, enter: nl -i10 -nrz -s:: -v10 -w4 chap1 This numbers the lines of chap1, starting with 10 (-v10) and counting by 10s (-i10). It displays four digits for each number (-w4), including leading zeroes (-nrz). The line numbers are separated from the text by two colons (-s::). For example, if chap1 contains the following text: A not-so-important note to remember: You can't kill time without injuring eternity. then the numbered listing is as follows: 0010::A not-so-important note to remember: 0020::You can't kill time without injuring eternity. Notice that the blank line was not numbered. To do this, use the -ba option as shown in Example 2. ENVIRONMENT VARIABLES
The following environment variables affect the execution of nl: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments and input files), the behavior of classes within regular expressions, and for deciding which characters are in character class graph. Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MES- SAGES. SEE ALSO
Commands: cat(1), pr(1) Standards: standards(5) nl(1)