LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-21-2010, 02:11 AM   #1
waha87
LQ Newbie
 
Registered: Oct 2010
Posts: 10

Rep: Reputation: 0
Question sed deletion help


Hello all..
plz help me.

I have a doubt regarding deletion usind sed. We can use following cammand to delete lines between 5 and 10 from filename.txt.

sed '5,10d' filename.txt

I have two variable $startline and $endline. How do use sed command with these variables? when i use
sed '$startline,endlined filename.txt
i am getting errors.
I know this is a basic syntax error, but plz help me to solve this.
 
Old 10-21-2010, 03:11 AM   #2
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 542

Rep: Reputation: 79
Try this:
Code:
sed "$startline,$endline d" filename.txt
 
Old 10-21-2010, 11:43 PM   #3
waha87
LQ Newbie
 
Registered: Oct 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Smile

Thnx angel115...
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sed: how to change MAC address string with sed cold Linux - Software 5 08-02-2010 07:43 AM
LILO deletion?? Psyco26 Slackware 11 01-06-2007 11:16 AM
deletion cerin MEPIS 3 12-04-2005 03:38 PM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM
lilo deletion Jeepee Linux - Newbie 6 07-08-2002 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:04 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