Sponsored Content
Top Forums Shell Programming and Scripting ksh sed - Extract specific lines with mulitple occurance of interesting lines Post 302889909 by popeye on Monday 24th of February 2014 11:59:43 AM
Old 02-24-2014
ksh sed - Extract specific lines with mulitple occurance of interesting lines

Data file example

Quote:
primary
Factory CTS 1.9.6(2) P1
*Slot 1 CTS 1.9.6(2) P1
Slot 2 CTS 1.7.1(4864) P1
loads file information
Factory (cmterm-CTS.1-9-6-2R-K9.P1)
CTS: CTS.1-9-6-2R-K9.P1.sbn
Touch: CTSDEV.1-9-6-2R-K9.P1.SPA
Slot 1 (cmterm-CTS.1-9-6-2R-K9.P1)
CTS: CTS.1-9-6-2R-K9.P1.sbn
Touch: CTSDEV.1-9-6-2R-K9.P1.SPA-G
Slot 2
No loads file
I look for primary and * to isolate the interesting slot number.

Code:
slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'`

Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk indicates the interesting slot, "Slot 1"

Code:
sed -n '/\s+"$gslot"/p; /Touch:/p'

Output
Quote:

Slot 1
Touch: CTSDEV.1-9-6-2R-K9.P1.SPA
Touch: CTSDEV.1-9-6-2R-K9.P1.SPA-G
My question is :
How do I get only the Touch line following the Slot 1 line ? (marked that interesting line with a "-G"

Ofcourse I could have missed something, ... looking through books and the web but I havent found anything that addresses this issue.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

extract specific lines from file

hi, how would i extract a range of lines in a file by using the line number? ex: file contains: 1 title 2 i want 3 this part 4 to be taken out 5 from this file 6 and sent to 7 another file 8 not needed 9 end of file In this case, i want to copy line number 2 to 7 on a new... (2 Replies)
Discussion started by: apalex
2 Replies

2. UNIX for Dummies Questions & Answers

Extract specific lines for graphing

Hello, I have a very large text file with about 2 million lines. Each of the lines starts like.. SNP_12345678 A 1212, 121, 343, ... SNP_12345678 B 4567, 567, 454, ... and so on. I want to extract specific SNPs and plot them by GNUplot or excel. The file is too large to be opened by text... (1 Reply)
Discussion started by: genehunter
1 Replies

3. Shell Programming and Scripting

extract the lines between specific line number from a text file

Hi I want to extract certain text between two line numbers like 23234234324 and 54446655567567 How do I do this with a simple sed or awk command? Thank you. ---------- Post updated at 06:16 PM ---------- Previous update was at 05:55 PM ---------- found it: sed -n '#1,#2p'... (1 Reply)
Discussion started by: return_user
1 Replies

4. Shell Programming and Scripting

Extract lines of text based on a specific keyword

I regularly extract lines of text from files based on the presence of a particular keyword; I place the extracted lines into another text file. This takes about 2 hours to complete using the "sort" command then Kate's find & highlight facility. I've been reading the forum & googling and can find... (4 Replies)
Discussion started by: DionDeVille
4 Replies

5. UNIX for Dummies Questions & Answers

unix: extract a specific list of lines from a file

I would like to extract specific lines from a file and output them into another file. Each line in the file has a unique ID, and I have a specific list of IDs (that are not consecutive) that I wish to extract. for example: 1 aaaaaa bbbcb cccccc 2 aaaaaa bbbbb cccccd 3 aaaaaa bbbab... (6 Replies)
Discussion started by: mert2481
6 Replies

6. Shell Programming and Scripting

Extract specific lines from a file

Hi, I have a file which contains DDL statements- CREATE TABLE, CREATE INDEX, ALTER TABLE etc. I have to only pick CREATE TABLE statements from the file- Source : ---------------------------------------------- --DDL for table abc -------------------------------------------- CREATE TABLE... (4 Replies)
Discussion started by: newb
4 Replies

7. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

8. UNIX for Dummies Questions & Answers

Extract lines with specific words with addition 2 lines before and after

Dear all, Greetings. I would like to ask for your help to extract lines with specific words in addition 2 lines before and after these lines by using awk or sed. For example, the input file is: 1 ak1 abc1.0 1 ak2 abc1.0 1 ak3 abc1.0 1 ak4 abc1.0 1 ak5 abc1.1 1 ak6 abc1.1 1 ak7... (7 Replies)
Discussion started by: Amanda Low
7 Replies

9. Shell Programming and Scripting

Extract lines with unique value using a specific column

Hi there, I need a help with extracting data from tab delimited file which look like this #CHROM POS ID REF ALT Human Cow Dog Mouse Lizard chr2 3033 . G C 0/0 0/0 0/0 1/1 0/0 chr3 35040 . G T 0/0 0/0 ./. 1/1 0/1 chr4 60584 . T G 1/1 1/1 0/1 1/1 0/0 chr10 7147815 . G A 0/0 1/1 0/0 0/0... (9 Replies)
Discussion started by: houkto
9 Replies

10. Shell Programming and Scripting

Extract specific lines based on another file

I have a folder containing text files. I need to extract specific lines from the files of this folder based on another file input.txt. How can I do this with awk/sed? file1 ARG 81.9 8 81.9 0 LEU 27.1 9 27.1 0 PHE .0 10 .0 0 ASP 59.8 11 59.8 0 ASN 27.6 12 27.6 0 ALA .0 13 .0 0... (5 Replies)
Discussion started by: alanmathew84
5 Replies
isdn_audio(4)							   Special files						     isdn_audio(4)

NAME
isdn_audio - audio extension of ttyI ISDN character devices DESCRIPTION
This document describes the audio related extensions of the modem emulation, provided by /dev/ttyIx. The ISDN tty devices are equipped with a modem emulation implementing a set of traditional and some special AT commands. This provides easy use together with almost all communication software that uses modem commands: minicom(1), seyon(1), XCept(1), uucico(8), mgetty(8), dip(8), pppd(8) and more. When enabled during kernel configuration, the emulator is capable of a reduced set of commands to support audio. To use audio features, an ISDN card with a audio-capable low-level driver is needed. Currently the only audio-capable drivers are the teles and HiSax driver. The port speed of the ISDN tty devices is always 64000 bps. AUDIO RELATED AT COMMAND SET
This description does not include the standard AT command set. For a description of the standard AT command set, provided by the Linux ISDN subsystem, see ttyI(4). All commands starting with AT+ except AT+FCLASS are enabled only, if audio mode is active. The following audio related AT commands are supported by ISDN tty devices: AT+FCLASS=0 Disable audio mode (default). This command sets register 18 to 4. AT+FCLASS=8 Enable audio mode. This command sets register 18 to 5. AT+FCLASS=? Show possible modes. AT+FCLASS? Show current mode. AT+VNH=x No function, provided for compatibility only. AT+VNH=? Always showing "1". AT+VNH? Always showing "1". AT+VIP Reset all audio parameters. AT+VLS=x Select line x, where x is one of the following: 0 = No device. 2 = Phone line. AT+VLS=? Always showing "0,2". AT+VLS? Show current line. AT+VRX Start audio recording. See below for more information. AT+VSD=x,y Set silence-detection parameters. Possible parameters: x = 0 ... 31 sensitivity threshold level. (default 0 , deactivated) y = 0 ... 255 range of interval in units of 0.1 second. (default 70) AT+VSD=? Show possible parameters. AT+VSD? Show current parameters. AT+VSM=x Select audio data format to x, where x is: 2 = ADPCM-2 3 = ADPCM-3 4 = ADPCM-4 5 = aLAW 6 = uLAW AT+VSM=? Show possible audio data formats. AT+VSM? Show current audio data format. AT+VTX Start audio playback. See below for more information. GENERAL BEHAVIOUR
On incoming calls, if the application responds to a RING by sending ATA, depending on the calling service, the emulator responds with either CONNECT (data call) or VCON (voice call). When starting audio playback or recording, the emulator responds with CONNECT. After that, the data transfer protocol described below is used. It is possible to initiate full duplex data transfer by issuing AT+VRX+VTX in a single command. In this case, no CONNECT message is sent to the application and the protocol described below is started immediately. When stopping audio playback or recording, the message returned by the emulator depends on how the data transfer is stopped. If the data transfer is stopped by a remote hangup, NO CARRIER is sent to the application, while stopping data transfer with one of the DLE sequences, VCON is sent. In any case, the message is preceded by the appropriate DLE sequence for end of audio data and/or abort respectively. On outgoing voice calls, the emulator responds with VCON upon connection setup. AUDIO DATA FORMAT
When recording or playing back audio data, a kind of modified bisync protocol is used. When recording audio data, the modem emulator is considered to be the sender, while the application is the receiver. When playing back, this relationship is reversed: The modem emulator acts as receiver, while the application is the sender. With the bisync protocol the character DLE (0x10) has a special meaning and is used like an escape character. It is always followed by a second character which has the following meanings defined: ETX (0x03) End of audio data. This code has to be sent by the sender, indicating end of audio data. DC4 (0x14) Abort sending. This code has to be sent by the receiver, when it wishes to abort receiving data. The sender has to reply by stop sending data and finally indicating end of audio data. DLE (0x10) a single byte with value 0x10 in the data stream. 0 Touch-tone "0" received. Valid only in direction from emulator to application. 1 Touch-tone "1" received. Valid only in direction from emulator to application. 2 Touch-tone "2" received. Valid only in direction from emulator to application. 3 Touch-tone "3" received. Valid only in direction from emulator to application. 4 Touch-tone "4" received. Valid only in direction from emulator to application. 5 Touch-tone "5" received. Valid only in direction from emulator to application. 6 Touch-tone "6" received. Valid only in direction from emulator to application. 7 Touch-tone "7" received. Valid only in direction from emulator to application. 8 Touch-tone "8" received. Valid only in direction from emulator to application. 9 Touch-tone "9" received. Valid only in direction from emulator to application. # Touch-tone "#" received. Valid only in direction from emulator to application. * Touch-tone "*" received. Valid only in direction from emulator to application. A Touch-tone "A" received. Valid only in direction from emulator to application. B Touch-tone "B" received. Valid only in direction from emulator to application. C Touch-tone "C" received. Valid only in direction from emulator to application. D Touch-tone "D" received. Valid only in direction from emulator to application. AUTHOR
Fritz Elfert <fritz@isdn4linux.de> SEE ALSO
ttyI(4). ISDN 4 Linux 3.13 1999/09/06 isdn_audio(4)
All times are GMT -4. The time now is 01:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy