To cut a specific line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To cut a specific line
# 1  
Old 04-16-2009
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  
Old 04-16-2009
you need to remove it right??
Code:
sed 's/iframe frameborder//g' filenames

# 3  
Old 04-16-2009
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  
Old 04-16-2009
Quote:
Originally Posted by gsiva
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  
Old 04-16-2009
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  
Old 04-16-2009
Hi Guys,

Any help on my problem.
# 7  
Old 04-16-2009
Be more patient, it's against rule 4 to bump up questions.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to cut a specific pattern from a line

Hello, I need to cut a specific pattern from a line irrespecitve of knowing field place. I am aware to cut field if you know the place of the field, but for me The sting place varies. 1468129514436,0,something_error,Non HTTP response code: java.net.URISyntaxException,Non HTTP response... (5 Replies)
Discussion started by: mirwasim
5 Replies

2. Shell Programming and Scripting

Cut from specific line number to a line number

Hi All, I've a file like this.. Sheet1 a,1 a,2 a,3 a,4 a,5 Sheet2 a,6 a,7 a,8 a,9 a,10 Sheet3 a,11 a,12 a,13 (7 Replies)
Discussion started by: manab86
7 Replies

3. Shell Programming and Scripting

sed or awk, cut, to extract specific data from line

Hi guys, I have been trying to do this, but... no luck so maybe you can help me. I have a line like this: Total Handled, Received, on queue Input Mgs: 140 / 14 => 0 I need to, get the number after the / until the =, to get only 14 . Any help is greatly appreciated. Thanks, (4 Replies)
Discussion started by: ocramas
4 Replies

4. Shell Programming and Scripting

Using awk to read a specific line and a specific field on that line.

Say the input was as follows: Brat 20 x 1000 32rf Pour 15 p 1621 05pr Dart 10 z 1111 22xx My program prompts for an input, what I want is to use the input to locate a specific field. Like if I type in, "Pou" then it would return "Pour" and just "Pour" I currently have this line but it is... (6 Replies)
Discussion started by: Bungkai
6 Replies

5. Shell Programming and Scripting

cut specific pattern

Hi i want to cut a variable like if it is ABCDEF then i want to cut "DEF" only Please help me regarding this. (1 Reply)
Discussion started by: aishsimplesweet
1 Replies

6. Slackware

How should I cut this line using cut and grep?

not sure how to do it. wan't to delete it using cut and grep ince i would use it in the shell. but how must the command be? grep "64.233.181.103 wwwGoogle.com" /etc/hosts | cut -d the delimeter is just a space. can you help meplease. :D (1 Reply)
Discussion started by: garfish
1 Replies

7. Shell Programming and Scripting

How to cut specific line and one line under?

Hi guys, I need to analyze the following alert log file: Beginning log switch checkpoint up to RBA , SCN: 3916025539605 Sat May 1 00:54:52 2010 Thread 1 advanced to log sequence 271423 (LGWR switch) Current log# 1 seq# 271423 mem# 0: /dw/stg_redo01/log_dwstg_g1_m1.log Current log# 1... (7 Replies)
Discussion started by: nir_s
7 Replies

8. Shell Programming and Scripting

How to cut first line only from a text near a specific column without cutting a word

First I have to say thank you to this community and this forum. You helped me very much builing several useful scripts. Now, I can't get a solution the following problem, I'm stuck somehow. Maybe someone has an idea. In short, I dump a site via lynx and pipe the output in a file. I need to... (7 Replies)
Discussion started by: lowmaster
7 Replies

9. UNIX for Advanced & Expert Users

cut a specific value from a column

Dear Friends, I have an output like this: 7072;0;7072901 7072;1001;7072902 7072;101;7072903 7072;102;7072904 7072;1101;7072905 7072;1301;7072906 7072;1401;7072907 7072;162;7072908 7072;1;7072909 and I need to print the value in the column 3 , row number 1. which is 7072901 only.... (2 Replies)
Discussion started by: sfaqih
2 Replies

10. Shell Programming and Scripting

cut specific records from a file

I am trying to cut the first 10 characters from a file only if the file has 'xyz' in field 185-188. I tried this cat filename | cut -c1-10 but this gives me all the records regardless of what is in field 185-188. Is this doable ? Thanks in advance for responses. (2 Replies)
Discussion started by: jxh461
2 Replies
Login or Register to Ask a Question