LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-18-2007, 10:39 PM   #16
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mint, Mandriva
Posts: 221

Rep: Reputation: 31

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 )
 
Old 02-19-2007, 07:08 AM   #17
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
Hi, cfaj.

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Make a script remove lines from a file? spiffytech Linux - Software 5 12-29-2005 11:50 AM
How to remove lines from a file doza Linux - General 2 04-27-2005 11:59 AM
remove identical lines in a file benjithegreat98 Linux - General 4 04-24-2004 06:12 AM
How do i remove blank lines from a file? kakho Programming 1 04-15-2004 03:57 AM
[bash] remove lines from a file Drimo Programming 3 03-20-2004 11:16 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration