Sponsored Content
Top Forums Shell Programming and Scripting Removing header or footer from file Post 302650691 by balajesuri on Monday 4th of June 2012 05:43:26 AM
Old 06-04-2012
I'm assuming by header and footer you mean the first and last line of file.

To remove both "header" and "footer"
Code:
sed '1d; $d' inputfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to Chop Header and Footer record from input file

Hi, I need to chope the header and footer record from an input file and make a new output file, please let me know how i can do it in unix.thanks. (4 Replies)
Discussion started by: coolbudy
4 Replies

2. Shell Programming and Scripting

Total of lines w/out header and footer incude for a file

I am trying to get a total number of tapes w/out headers or footers in a ERV file and append it to the file. For some reason I cannot get it to work. Any ideas? #!/bin/sh dat=`date +"%b%d_%Y"` + date +%b%d_%Y dat=Nov16_2006 tapemgr="/export/home/legato/tapemgr/rpts"... (1 Reply)
Discussion started by: gzs553
1 Replies

3. Shell Programming and Scripting

Split large file and add header and footer to each file

I have one large file, after every 200 line i have to split the file and the add header and footer to each small file? It is possible to add different header and footer to each file? (1 Reply)
Discussion started by: ashish4422
1 Replies

4. Shell Programming and Scripting

Split large file and add header and footer to each small files

I have one large file, after every 200 line i have to split the file and the add header and footer to each small file? It is possible to add different header and footer to each file? (7 Replies)
Discussion started by: ashish4422
7 Replies

5. Shell Programming and Scripting

sort a report file having header and footer

I am having report file with header and footer . The details in between header and footer are separated by a pipe charater. I want to sort the file by considering multiple columns in between header and footer. pls help (4 Replies)
Discussion started by: suryanarayana
4 Replies

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

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

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

9. UNIX for Dummies Questions & Answers

File Row Line Count without Header Footer

Hi There! I am saving the file count of all files in a directory to an output file using: wc -l * > FileCount.txt I get: 114 G4SXORD 3 G4SXORH 0 G4SXORP 117 total But this count includes header and footer. I want to subtract 2 from the count and get ... (7 Replies)
Discussion started by: gagan8877
7 Replies

10. UNIX for Dummies Questions & Answers

Eliminate Header and footer from EBCDIC file

Is there any command to eliminate Header and footer from EBCDIC file (4 Replies)
Discussion started by: abhilashnair
4 Replies
nl(1)							      General Commands Manual							     nl(1)

NAME
nl - line numbering filter SYNOPSIS
type] type] type] start#] incr] sep] width] format] num] delim] [file] DESCRIPTION
reads lines from the named file or the standard input if no file is named and reproduces the lines on the standard output. Lines are num- bered on the left in accordance with the command options in effect. views the text it reads in terms of logical pages. Line numbering is reset at the start of each logical page. A logical page consists of a header, a body, and a footer section. Empty sections are valid. Different line numbering options are independently available for header, body, and footer (e.g., no numbering of header and footer lines while numbering blank lines only in the body). The start of logical page sections are signaled by input lines containing nothing but the following delimiter character(s): | Line contents | Start of --------------+---------- ::: | header :: | body : | footer Unless told otherwise, assumes the text being read is in a single logical page body. Command options can appear in any order and can be intermingled with an optional file name. Only one file can be named. recognizes the following options: Specifies which logical page body lines are to be numbered. Recognized types and their meanings are: number all lines; number lines with printable text only; no line numbering; number only lines that contain the regular expression specified in string. Basic Regular Expression syntax is supported (see regexp(5)). The default type for logical page body is (text lines numbered). Same as except for header. Default type for logical page header is (no lines numbered). Same as except for footer. Default for logical page footer is (no lines numbered). Do not restart numbering at logical page delimiters. start# is the initial value used to number logical page lines. Default is incr is the increment value used to number logical page lines. Default is sep is the character or characters used in separating the line number and the corresponding text line. Default sep is a tab. width is the number of character columns to be used for the line number. Default width is format is the line numbering format. Recognized values are: left justified, leading zeroes suppressed; right justified, leading zeroes suppressed; right justified, leading zeroes kept. Default format is (right justified). num is the number of consecutive blank lines to be treated and numbered as a single line. For example, results in every third adjacent blank line being numbered if the appropriate and/or option is set. Default is The delimiter characters specifying the start of a logical page section can be changed from the default characters to two user-specified characters. If only one character is entered, the second character remains the default character No space should appear between the and the delimiter characters, how- ever, this restriction is not there for (see standards(5)) compliant To define a backslash as the delimiter, use two backslashes. EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see standards(5). Environment Variables determines the collating sequence used in evaluating regular expressions. determines the characters matched by character class expressions in regular expressions. If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty variable. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single-byte character code sets are supported. EXAMPLES
Number starting at line number 10, using an increment of ten. The logical page delimiters are and SEE ALSO
pr(1), environ(5), lang(5), regexp(5), standards(5). STANDARDS CONFORMANCE
nl(1)
All times are GMT -4. The time now is 08:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy