delete 1 followed by 3 lines 
Author Message
 delete 1 followed by 3 lines

I have a file in which one of the columns is like that:
1
2
2
3
1
3
1
2
3
1
3
and so on
i would like to delete all the lines that have 1 followed by 3 on the
next line.
Thanks

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 23 Jun 2002 03:00:00 GMT  
 delete 1 followed by 3 lines
I have a file in which one of the columns is like that:
1
2
2
3
1
3
1
2
3
1
3
and so on
i would like to delete all the lines that have 1 followed by 3 on the
next line.
Thanks

Sent via Deja.com http://www.deja.com/
Before you buy.



Sun, 23 Jun 2002 03:00:00 GMT  
 delete 1 followed by 3 lines

Quote:

> I have a file in which one of the columns is like that:
> 1
> 2
> 2
> 3
> 1
> 3
> 1
> 2
> 3
> 1
> 3
> and so on
> i would like to delete all the lines that have 1 followed by 3 on the
> next line.
> Thanks

What's your question?

This is a trivial programming problem. Did you post this non-inquiry
thinking someone would just write the script for you and post it to
comp.lang.awk?

Well guess what? Someone soon will.

Welcome to comp.lang.awk, the Pedagogy Newsgroup!

--
Jim Monty

Tempe, Arizona USA



Sun, 23 Jun 2002 03:00:00 GMT  
 delete 1 followed by 3 lines

Quote:

>I have a file in which one of the columns is like that:
>1
>2
>2
>3
>1
>3
>1
>2
>3
>1
>3
>and so on
>i would like to delete all the lines that have 1 followed by 3 on the
>next line.

So, save the line, and when you read a new one, decide whether the
prior one should be printed.  Be sure to cleanup at the end of the
file to handle possible printing of the last line.

Show us what you've written if you need more help.

Chuck Demas
Needham, Mass.

--
  Eat Healthy    |   _ _   | Nothing would be done at all,

  Die Anyway     |    v    | That no one could find fault with it.



Sun, 23 Jun 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. awk -- pattern match a line and the line that follows

2. find a key word and delete 5 lines before it and 5 lines after this

3. Following lines...

4. delete first 3 characters from any line

5. deleting newline from last line in file

6. deleting repeated lines

7. Delete empty lines

8. Newbie Help required: Deleting double entries in a line ($0)

9. How to delete a line in an editfielt?

10. Deleting lines in a file

11. Delete lines using AWK.

12. how to delete the a line in a file

 

 
Powered by phpBB® Forum Software