Sponsored Content
Full Discussion: sed searching across lines
Top Forums Shell Programming and Scripting sed searching across lines Post 302091351 by ghostdog74 on Monday 2nd of October 2006 09:41:32 AM
Old 10-02-2006
don't really have to code in C in order to do that
Alternative in Python, which is much easier:
Input file sample:
bla bla
...
erros is 1324546
the bla bla bla

bla bla bla...
...
...
bla bla
erros is 32423423
the bla bla 1
the bla bla 2
the bla bla 3

bla bla


Code:
all = open("input.txt").readlines()
for number,items in enumerate(all):
        if "erros" in items:
                num = number
        if items == "\n":
                print ''.join(all[num:number])

Output:
Code:
[root@localhost test]# ./test.py
erros is 1324546
the bla bla bla

erros is 32423423
the bla bla 1
the bla bla 2
the bla bla 3

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

lines searching >>

hi guys! I`ll really appreciate your help. The situation is: i have a log file, and i need to get the needed lines from it. linecount=$(cat -n http.log | grep ALERT | awk '{print $1}' | wc -l) lines=$(cat -n http.log | grep ALERT | awk '{print $1}') 1-string gets the number of found lines... (2 Replies)
Discussion started by: neverhood
2 Replies

2. Shell Programming and Scripting

Searching for lines ending with }

I'm trying to search for lines ending with "}" with the following command but am not getting any output. grep '\}$' myFile.txt I actually want to negate this (i.e. lines not ending with "}"), but I guess that should be easier once I find the command that finds it? (11 Replies)
Discussion started by: BootComp
11 Replies

3. UNIX for Dummies Questions & Answers

Searching for lines in a file?

What is the best way to display lines in a log file that begin with a certain string? Preferably I would like to 'print' them to a file. I guess I would use 'cat' for that? There are two types of line I would like to get at - each begins with a different two words. It would be something... (8 Replies)
Discussion started by: Sepia
8 Replies

4. Shell Programming and Scripting

Sed - Pattern Searching

Hi, Please take a look at the below eg. I would like to search for abc() pattern first and then search for (xyz) in the next line. If I can find the pattern, then I should delete the 3 lines. I can only find the pattern and delete but I am unable to find two patterns and delete. Any... (8 Replies)
Discussion started by: sreedevi
8 Replies

5. Shell Programming and Scripting

Searching for lines in textfiles

Hello all, I've a problem. I've two logfiles and i need to find lines in the second file by using information from the first file. First I need to extract a searchpattern from the first file. Its like abc=searchpattern&cde=. All between abc= and &cde= is the pattern I need to find in the second... (2 Replies)
Discussion started by: Avarion
2 Replies

6. Shell Programming and Scripting

Perl searching special words in lines

Hi , i am a new with perl, i want to made a script that find in file rows that start with specil words, as an example a line will start with" ............................................. specialword aaa=2 bbb=5 ............................................. and to put this in a new file... (3 Replies)
Discussion started by: alinalin
3 Replies

7. Shell Programming and Scripting

Insert tags in lines after searching for a word

Hi, I am new to Unix and this is my first post on this forum. I am trying to convert a file into an xml. In my input I want to search for any line that starts with a 'F' and make it a tag in the xml. See below for the input and output. Input : <Payment> <REFERENCE>78</REFERENCE> F123 : ... (7 Replies)
Discussion started by: akashgov
7 Replies

8. Shell Programming and Scripting

Searching inverted lines

Hi fellas, I have a file like this: A_B B_D C_D D_B E_F G_H B_A F_E In other words, I have member1_member2 and member2_member1 in the same file. In the exemple aforementioned I have A_B and B_A, B_D and D_B, E_F and F_E. So, I would like to know a sript that print the lines B_A, D_B... (3 Replies)
Discussion started by: valente
3 Replies

9. UNIX for Dummies Questions & Answers

Add lines after searching for a pattern

Hi, I have 2 files like below. File A: apple mango File B: start abc def apple ghi end start cba fed (4 Replies)
Discussion started by: jayadanabalan
4 Replies

10. Shell Programming and Scripting

Searching for pattern and remove the lines

Hi , I want to remove the specific pattern and remove those lines from file using shell script. i want to remove these lines <?xml version='1.0' encoding='UTF-8'?> <row_set> </row_set> my input file has content like this. file name: sample.xml <?xml version='1.0'... (4 Replies)
Discussion started by: nukala_2
4 Replies
POC-FEC(1)							   User Command 							POC-FEC(1)

NAME
poc-fec - send FEC MP3 streams SYNOPSIS
poc-fec [ -s address ] [ -p port ] [ -t ttl ] [ -q ] [ -k fec_k ] [ -n fec_n ] files... DESCRIPTION
poc-fec is a streaming server sending mp3 data using a custom FEC protocol. The streamed MP3 frames are first decomposed in autonomous data units (ADUs). These ADUs are grouped into ADU groups, which are encoded redundantly using a FEC method by Luigi Rizzo. A group of k ADUs is encoded as n data packets. Any k of these n data packets is sufficient to recover the original k ADUs. It sends the files in the order given on the command-line. Use the filename - to stream from standard input. Normally, the FEC protocol is used to stream to multicast groups. OPTIONS
-s address Specify the address to send to (default 224.0.1.23). -p port Specify the port to send to (default 1500). -t ttl Specify the TTL parameter to be set on outgoing parameters (default 1). -q Don't output any information on standard error. -k fec_k Specify the number of ADUs that will be encoded as an ADU group (default 20). -n fec_n Specify the number of packets that the ADU groups will be encoded to (default 25). This number must be greater than the fec_k param- eter. EXAMPLES
poc-fec -s 224.0.1.24 -p 8989 -t 2 -k 16 -n 32 bla.mp3 Send the file bla.mp3 using the RTP RFC fec protocol to the address 224.0.1.24 on port 8989, and set the TTL to 2. MP3 frames of bla.mp3 are converted to ADUs and grouped in ADU groups of 16 ADUs. These 16 ADUs are encoded into 32 packets and streamed. A client will have to receive at least 16 packets to recover the original ADUs. AUTHORS
Manuel Odendahl <manuel@bl0rg.net>, Florian Wesch <dividuum@bl0rg.net> February 2005 POC-FEC(1)
All times are GMT -4. The time now is 06:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy