LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 11: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, 08:08 AM   #17
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 719

Rep: Reputation: 72
Hi, cfaj.

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:50 PM
How to remove lines from a file doza Linux - General 2 04-27-2005 12:59 PM
remove identical lines in a file benjithegreat98 Linux - General 4 04-24-2004 07:12 AM
How do i remove blank lines from a file? kakho Programming 1 04-15-2004 04:57 AM
[bash] remove lines from a file Drimo Programming 3 03-20-2004 12:16 PM


All times are GMT -5. The time now is 01:55 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration