The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to delete first 5 lines and last five lines in all text files ragavendran31 Shell Programming and Scripting 10 02-21-2008 07:58 AM
Delete blocks of lines from text file nrbhole Shell Programming and Scripting 4 12-19-2007 06:17 AM
Delete a block of text delimited by blank lines when pattern is found gleu Shell Programming and Scripting 17 12-16-2007 11:30 PM
Delete specific lines in a text file dniz High Level Programming 9 08-08-2005 09:30 AM
delete blank lines or lines with spaces only vascobrito UNIX for Dummies Questions & Answers 3 01-13-2004 07:36 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-31-2006
umen umen is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 239
Delete lines containing text with sed

hello all
I have bunch of files containing lines of text that surrounding by <# …….#> tags
I like to delete this lines from the text files whiteout open the files , can it be done with sed ?
or other unix tool (perl mybe )?
  #2 (permalink)  
Old 08-01-2006
Klashxx's Avatar
Klashxx Klashxx is offline Forum Advisor  
HP-UX/Linux/Oracle
  
 

Join Date: Feb 2006
Location: Almería, Spain
Posts: 393
Use for blank lines:

Code:
perl -p -i -e 's/^.*<#.*#>.*$//' file

For delete lines:

Code:
perl -i.old -ne 'print unless /^.*<#.*#>.*$/' file


Last edited by Klashxx; 08-01-2006 at 08:04 AM..
  #3 (permalink)  
Old 08-01-2006
xinusys xinusys is offline
Registered User
  
 

Join Date: May 2006
Posts: 13
Smile Hi!

yup it can be done through sed.U have put a line in a script and run it against sed.

s/^#//g
hope it will solve ur prob.

cheers
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0