The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Deleting Characters at specific position in a line if the line is certain length Cailet Shell Programming and Scripting 10 12-17-2008 02:41 PM
Printing a specific line using AWK jake_won Shell Programming and Scripting 2 07-17-2008 11:53 AM
insert a line after specific line namishtiwari Shell Programming and Scripting 8 05-21-2008 02:16 PM
Adding a columnfrom a specifit line number to a specific line number Ezy Shell Programming and Scripting 2 05-12-2008 08:29 AM
To manipulate a specific line dhiman.sarkar UNIX for Dummies Questions & Answers 2 07-10-2005 04:57 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-16-2009
gsiva gsiva is offline
Registered User
  
 

Join Date: Dec 2008
Location: coimbatore
Posts: 107
To cut a specific line

Hi,

I need to remove a specific line from a file.. For eg: From the html codings, I need to find the word "iframe frameborder" and cut it . I tried with

find . -type f -exec grep -H 'iframe frameborder' {} \; > <filename>

From the output of this result, I need to remove the "iframe frameborder" from the files listed. I am not sure how to do this with a bash shell script.
  #2 (permalink)  
Old 04-16-2009
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,390
you need to remove it right??
Code:
sed 's/iframe frameborder//g' filenames
  #3 (permalink)  
Old 04-16-2009
gsiva gsiva is offline
Registered User
  
 

Join Date: Dec 2008
Location: coimbatore
Posts: 107
Sorry I wanna to be in more detail, I want to remove the entire line of iframe as

<iframe frameborder=0 border=0 height=1 width=1 src="http://example.com" />
  #4 (permalink)  
Old 04-16-2009
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,390
Quote:
Originally Posted by gsiva View Post
Sorry I wanna to be in more detail, I want to remove the entire line of iframe as

<iframe frameborder=0 border=0 height=1 width=1 src="http://example.com" />
so you wanna remove the line containing "iframe frameborder"??
Code:
 
sed '/iframe frameborder/d' filename
  #5 (permalink)  
Old 04-16-2009
gsiva gsiva is offline
Registered User
  
 

Join Date: Dec 2008
Location: coimbatore
Posts: 107
Hi, Did tried with removing like this, but no luck,

for i in `find . -type f -exec grep -H 'iframe frameborder' {} \; > l`
do
sed 's/<iframe frameborder=0 border=0 height=1 width=1 src="http://www.example.com"/d' $i;
done

I am not sure whether I am right.. If then I find for the iframe, all the files are still listing.
  #6 (permalink)  
Old 04-16-2009
gsiva gsiva is offline
Registered User
  
 

Join Date: Dec 2008
Location: coimbatore
Posts: 107
Hi Guys,

Any help on my problem.
  #7 (permalink)  
Old 04-16-2009
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,390
Quote:
Originally Posted by gsiva View Post
Hi, Did tried with removing like this, but no luck,

for i in `find . -type f -exec grep -H 'iframe frameborder' {} \; > l`
do
sed 's/<iframe frameborder=0 border=0 height=1 width=1 src="http://www.example.com"/d' $i;
done

I am not sure whether I am right.. If then I find for the iframe, all the files are still listing.
you can't write it just like that you need to escape special char like /. etc.
try yourself..
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 06:26 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