Sponsored Content
Top Forums Shell Programming and Scripting sed Range Pattern and 2 lines before Start Pattern Post 302960209 by y2jacky on Thursday 12th of November 2015 05:29:07 AM
Old 11-12-2015
Hi Don,

Actually the Sample Input was made up arbitrarily by me. It does not necessarily contain the string "Srt". Therefore the sed command, which I was trying should not work.

With regards to your suggestion of using "ed" command, that is just perfect and what I was looking for. To be honest, I didn't know this command even existed...though I know it does now. I'll look into the man page of "ed" now.

I'll try to play around with it for now.

Thanks a lot for the quick assistance Don! Really appreciate it!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed in sed range pattern

Hi all, I am using sed for extracting the lines that occurs between the 2 patterns using the following command: sed -n '/pattern1/,/pattern2/' filename The above command has no problem and works fine. But I was wondering if there is a way to quit sed when it has extracted the range at... (3 Replies)
Discussion started by: sank
3 Replies

2. Shell Programming and Scripting

sed: Find start of pattern and extract text to end of line, including the pattern

This is my first post, please be nice. I have tried to google and read different tutorials. The task at hand is: Input file input.txt (example) abc123defhij-E-1234jslo 456ujs-W-abXjklp From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies

3. Shell Programming and Scripting

sed pattern range

Hi guys, trying to replace a '#' with a ' ' (space) but only between the brackets '(' and ')' N="text1#text2#text3(var1#var2#var3)" N=`echo $N |sed '/(/,/) s/#. //'` echo $N Looking for an output of "text1#text2#text3(var1 var2 var3)" Any ideas? (15 Replies)
Discussion started by: mikepegg
15 Replies

4. Shell Programming and Scripting

How to combine lines within range of pattern

I've a file say having line 1 line 2 (NP line 3 line 4 line 5) line 6 I want to combine lines starting from (NP and ending with ) then it will look like line 1 line 2 (NP line3 line4 line5) line 6 I tried using sed '/(NP/,/)$/ s/\n/ /' but it's not working. Any help please? ... (8 Replies)
Discussion started by: neg
8 Replies

5. Shell Programming and Scripting

How to print range of lines using sed when pattern has special character "["

Hi, My input has much more lines, but few of them are below pin(IDF) { direction : input; drc_pinsigtype : signal; pin(SELDIV6) { direction : input; drc_pinsigtype : ... (3 Replies)
Discussion started by: nehashine
3 Replies

6. Shell Programming and Scripting

sed pattern to delete lines containing a pattern, except the first occurance

Hello sed gurus. I am using ksh on Sun and have a file created by concatenating several other files. All files contain header rows. I just need to keep the first occurrence and remove all other header rows. header for file 1111 2222 3333 header for file 1111 2222 3333 header for file... (8 Replies)
Discussion started by: gary_w
8 Replies

7. Shell Programming and Scripting

Sed print range of lines between line number and pattern

Hi, I have a file as below This is the line one This is the line two <\XMLTAG> This is the line three This is the line four <\XMLTAG> Output of the SED command need to be as below. This is the line one This is the line two <\XMLTAG> Please do the need to needful to... (4 Replies)
Discussion started by: RMN
4 Replies

8. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies

9. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

10. Shell Programming and Scripting

[sed] Finding and sticking the pattern to the beginning of successive lines up to the next pattern

I have a file like below. 2018.07.01, Sunday 09:27 some text 123456789 0 21 0.06 0.07 0.00 2018.07.02, Monday 09:31 some text 123456789 1 41 0.26 0.32 0.00 09:39 some text 456789012 1 0.07 0.09 0.09 09:45 some text 932469494 1 55 0.29 0.36 0.00 16:49 some text 123456789 0 48 0.12 0.15 0.00... (9 Replies)
Discussion started by: father_7
9 Replies
vbox.conf(5)						    Linux System Administration 					      vbox.conf(5)

NAME
vbox.conf - config file for vbox Description This file is used to configure when and on what conditions calls are taken. It can also be used to define which CALLERID is used with which person. Everything after the "#" is ignored, as are empty lines. All arguments must be separated by whitespace (spaces, tabs). Arguments may not contain whitespace. This file consists of several sections. A section begins with "[" NAME "]". The section name is case insensitive. A section ends at the end of the file or at the end of a new section. These sections exist: [CALLERIDS] This section maps CALLERID to persons and what settings to use. On an incoming call the CALLERID of the caller is detected and compared with this section. The SECTION of the first match is used. Format : PATTERN SECTION REALNAME PATTERN UN*X Pattern of a CALLERID. You may not use whitespace. SECTION Name of a user section to use. You many not use whitespace. With a "-" STANDARD will be used, with a "*" the REALNAME will be used. REALNAME Full name of the person that should be mapped to the CALLERID. Here you may use spaces. At the end of the [CALLERIDS] Section, you should have the entry "* - *** Unknown ***", so that also calls with no or unknown CAL- LERID can be processed. [RINGS] In this section you set when and after how many RINGs a call is taken. This section is the first to be examined when a call is incoming to determine if the call should be taken. The number of RINGs can be overruled in the user section. Format : TIME DAYS RINGS TIME time when the call should be taken. Read the isdntime(5) man page for details. DAYS days when the call should be takes. Read the isdntime(5) man page for details. RINGS Number of rings to wait before taking the call. With version 2.0 of the hisax isdn device driver the interval between two rings is longer (now it's nearly like a telephone; 4 - 5 seconds between rings). user defined sections Here you can make individual settings for some people. The section name has the same format as the other sections. The names CAL- LERIDS and RINGS are reserved. Format : TIME DAYS MESSAGE RECTIME [FLAG] [...] TIME time when the call should be taken. Read the isdntime(5) man page for details. DAYS days when the call should be taken. Read the isdntime(5) man page for details. MESSAGE Standard message to play for this call. You must either give the filename with full path, or a filename relative to /var/spool/vbox/<user>/messages. Default is "standard.msg". You may not use spaces or tabs. RECTIME Time in seconds: how long should vboxgetty record? Default is 60 seconds. FLAGS You can additionally give these flags: NOANSWER Don't answer this call. Default is to answer. NORECORD Don't record a message. Default is to record. NOTIMEOUTMSG Don't play timeout message. Default is to play. NOBEEPMSG Don't play beep message. Default is to play. NOSTDMSG Don't play std message. Default is to play. RINGS= Number of rings to wait before taking the call. Here you can override the [RINGS] section. TOLLRINGS= Number of rings to wait before answering the call, if new messages are available. This flag overrides the section [RINGS] and the flag RINGS= if there are new messages. The directory to search for new messages must be given with TOLLCHECK (or you can use the default). TOLLCHECK= Directory to search for new messages. Default is /var/spool/vbox/<user>/incoming. SCRIPT= TCL-Script to start after taking the call. This must be the full path or a filename relative to /var/spool/vbox/<user>. The default is standard.tcl. FILES
/var/spool/vbox/<user>/vbox.conf this configuration file. /usr/doc/isdnutils/examples/vbox.conf an example. SEE ALSO
isdntime(5) AUTHOR
This manual page was written by Andreas Jellinghaus <aj@dungeon.inka.de>, for Debian GNU/Linux and isdn4linux. ISDN 4 Linux 3.1pre4 2000/09/15 vbox.conf(5)
All times are GMT -4. The time now is 02:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy