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
comment text in a file learnbash Shell Programming and Scripting 8 04-11-2009 03:36 PM
remove verticalbar or pipe symbol bogu0001 Shell Programming and Scripting 9 01-30-2009 09:24 AM
Invoke URL's from file and comment with # symbol which are not working gsp UNIX for Dummies Questions & Answers 0 08-23-2007 03:55 AM
remove single-line comment Icy002 High Level Programming 3 04-09-2006 09:30 AM
Need to add a comment line in a text file orakhan Shell Programming and Scripting 2 09-22-2005 09:36 PM

Reply
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 06-23-2009
joyan321 joyan321 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 9
Remove the comment symbol ' from a file.

I want to remove the commented lines in a file identified by ' symbol at the start of each ine. A sample example will be like:

Input
-----
'IFerr_flag=0THEN
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then

Output
-------
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
  #2 (permalink)  
Old 06-23-2009
durden_tyler's Avatar
durden_tyler durden_tyler is online now Forum Advisor  
Registered User
  
 

Join Date: Apr 2009
Posts: 552
Quote:
Originally Posted by joyan321 View Post
I want to remove the commented lines in a file identified by ' symbol at the start of each ine. ...

Code:
sed "/^ *'/d" filename >tmp ; mv tmp filename

tyler_durden
  #3 (permalink)  
Old 06-23-2009
joyan321 joyan321 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 9
Quote:
Originally Posted by durden_tyler View Post
Code:
sed "/^ *'/d" filename >tmp ; mv tmp filename

tyler_durden
Thanks so much ....
  #4 (permalink)  
Old 06-23-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,949

Code:
grep -v "^'" filename

Reply

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 01:09 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