Sponsored Content
Top Forums Shell Programming and Scripting How to print range of lines using sed when pattern has special character "[" Post 302418969 by nehashine on Thursday 6th of May 2010 01:31:19 AM
Old 05-06-2010
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

Code:
        pin(IDF[3]) {
                direction       :       input;
                drc_pinsigtype  :       signal;
        pin(SELDIV6) {
                direction       :       input;
                drc_pinsigtype  :       signal;

And i want output:
Code:
        pin(IDF[3]) {
                direction       :       input;
                drc_pinsigtype  :       signal;
        pin(SELDIV6) {

In my script:
Code:
set pinname = "IDF[3]"
sed -n "/$pinname/,/pin/p" <inputfile>

but above command is giving error because of the presence of special character "[" & "]".

Where i am doing mistake, please let me know.

Last edited by Scott; 05-06-2010 at 05:38 AM.. Reason: Code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. UNIX for Dummies Questions & Answers

perl split funciton - special character "/"

HI, I have a directory structure. /abc/def/ghi/ I want to store it into array. So that if I do a pop function on that array I can easily go to previous directory. But how can i split and store it. @Directory = split(/\//,$DirectoryVarialbe) That doest works. Any other escape sequence... (5 Replies)
Discussion started by: deepakwins
5 Replies

3. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

4. Shell Programming and Scripting

Using sed to find text between a "string " and character ","

Hello everyone Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies

5. 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

6. Shell Programming and Scripting

Unable to identify the special characters beyond the range of "[\x80-\xFF]"

I want to filter out the special character whose ascii value doesn't fall within the range "" . Example:� or Ć. So in that case is there any defined range which will filter out this characters. I can filter those which falls withing "" . Need to filter those special chracter which doesn't... (14 Replies)
Discussion started by: Abhijit Sen
14 Replies

7. Shell Programming and Scripting

sed random \n for "n" range of character occurrences

I'd like to put paragraph breaks \n\n randomly between 5 - 10 occurrences of the dot character (.), for an entire text file. How to do that? In other words, anywhere between every 5 -10 sentences, a new paragraph will generate. There are no other uses of the (.) except for sentence breaks in... (11 Replies)
Discussion started by: p1ne
11 Replies

8. Shell Programming and Scripting

Remove word after special character "/"

Hi There, I have one requirement to remove word after character "/". Input file is 2017-07-12|02|user1l|domain1/userl|0 2017-07-12|02|user2|domain1/user2|5 2017-07-12|02|user3|domain2/user3|0 2017-07-12|02|user4|domain1/user4|432 and require OP file is ... (2 Replies)
Discussion started by: anshu ranjan
2 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

10. UNIX for Beginners Questions & Answers

Remove a word that ends with special character "!"

Hi all. I want to use sed to remove a word that ends with "!" in the first page of a file. The word I want to remove is: "DNA!". I have search for an answer and nothing of what I found helped me. ~faizlo (2 Replies)
Discussion started by: faizlo
2 Replies
mdc(4)							     Kernel Interfaces Manual							    mdc(4)

Name
       mdc - DS5100 serial line driver

Syntax
       device	 mdc0	  at ibus?     vector mdcintr
       device	 mdc1	  at ibus?     vector mdcintr
       device	 mdc2	  at ibus?     vector mdcintr

Description
       A  DS5100 base system (mdc0) provides four asynchronous ports.  An optional asynchronous card (mdc1 and mdc2 ) can be added to supply eight
       additional ports.

       The mdc ports are used as follows:

       Port    Usage			  Connector

       0       Console port		  6-pin MMJ on CPU board
       1       Local terminal		  6-pin MMJ on CPU board
       2       Full modem control port	  25-pin D-Sub on CPU board
       3       Local terminal		  6-pin MMJ on CPU board

       An optional asynchronous board provides an additional eight lines:

       4       Local terminal		  6-pin MMJ
       5       Local terminal		  6-pin MMJ
       6       Full modem control port	  25-pin D-Sub
       7       Local terminal		  6-pin MMJ
       8       Local terminal		  6-pin MMJ
       9       Local terminal		  6-pin MMJ
       10      Local terminal		  6-pin MMJ
       11      Local terminal		  6-pin MMJ

       The console baud rate is set to 9600 baud by default.  You can change this by setting the baud environment variable  from  console  prompt.
       Each  communication  port  from	the  serial  line controller behaves as described in the reference page and can be set to run at any of 16
       speeds.	For the encoding, see

       You can establish the state of port 2 (port 6) by specifying either modem or nomodem as part of the file entry.

Restrictions
       The speed default is to 9600 baud on the console port.  The console device must be set for 8-bit character length with one stop bit and	no
       parity. The driver enforces these restrictions; that is, changing speeds with the command may not always work on console ports.

Files
       Console terminal

       Full modem control or local terminal

See Also
       console(4), devio(4), tty(4), ttys(5), MAKEDEV(8)

								       RISC								    mdc(4)
All times are GMT -4. The time now is 06:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy