LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to remove first 2 lines of a file in a script (https://www.linuxquestions.org/questions/programming-9/how-to-remove-first-2-lines-of-a-file-in-a-script-526606/)

cfaj 02-18-2007 10:39 PM

Quote:

Originally Posted by makyo
Hi.

Here is an alternative to sed for skipping the first 2 lines of a file, namely by using tail:
[CODE]#!/bin/sh

# @(#) s1 Demonstrate tail copying from beginning.

rm -f t1 t2
seq 100 >t1
L1=$( cat t1 | wc -l )

Why are you using cat?

Code:

L1=$( wc -l < t1 )

makyo 02-19-2007 07:08 AM

Hi, cfaj.

Left-over habit. Thanks for pointing out the better construction ... cheers, makyo


All times are GMT -5. The time now is 08:20 PM.