Sponsored Content
Top Forums Shell Programming and Scripting how to find matching braces using sed or in shell script Post 302257245 by Boopesh on Tuesday 11th of November 2008 06:18:21 PM
Old 11-11-2008
how to find matching braces using sed or in shell script

hi,
I want to print all the lines between the matching braces.
For example,the file contains like the below.
asdfsdf
fsdfsd
WO{
w1{
ada
}
w2
{
}
}
sdfsdf
Here i want to print all the lines between WO{ and its corresponding closing brace.
This is very urgent, can somebody help me pls...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to find file name for non matching pattern

Hi, I want to list only the file names which do not contain a specific keyword or search string. OS: Solaris Also is there any way ; through the same script I can save the output of search to a CSV (comma seperated) so that the file can be used for inventory purpose. Any assistance will... (5 Replies)
Discussion started by: sujoy101
5 Replies

2. Shell Programming and Scripting

Finding the line number of matching braces

Hi,I am new to shell scripting and i want to find the line numbers of matching braces. The file contents are as follows File XXX.dat 1 ( CLASS "FRUIT" 2 (TYPE "PERSISTENT") 3 (MESSAGE_TYPE "M") 4 (GET_REQRD "Y") 5 (SET_REQRD "Y") 6 ) 7 ( CLASS... (3 Replies)
Discussion started by: Rajendra_1510
3 Replies

3. Shell Programming and Scripting

sed find matching pattern delete next line

trying to use sed in finding a matching pattern in a file then deleting the next line only .. pattern --> <ad-content> I tried this but it results are not what I wish sed '/<ad-content>/{N;d;}' akv.xml > akv5.xml ex, <Celebrant2First>Mickey</Celebrant2First> <ad-content> Minnie... (2 Replies)
Discussion started by: aveitas
2 Replies

4. Shell Programming and Scripting

Select block of text around matching braces

Hi, I have several block of text that I need to select, however this text may be spread over several lines and contains the '{' and '}' within it. For e.g., ABC=100{ DEF = 200 { GHI, JKL } } #2nd Block 123 { 456{78,910}} }I am trying to figure out how to remove... (2 Replies)
Discussion started by: BootComp
2 Replies

5. UNIX for Dummies Questions & Answers

Matching pattern script (sed or awk?)

Hi Guys, I am new to the forum and to scripting so bear with me. Thanks, Gary. I have 3 files - file1, file2, file3 I am trying to come up with a script that will check the output of these files and if the 1st nine fields are matched in all 3 files, echo "The following string had been... (2 Replies)
Discussion started by: gazza-o
2 Replies

6. Shell Programming and Scripting

find -regex not recognizing curly braces

Must be a bug or something. Whether I escape them or not, it will not work. No matter what I set the minimum and maximum to nothing gets caught. For instance: find / -regex "/.{0, 50}.*" -maxdepth 1 or find / -regex "/.\{0, 50\}.*" -maxdepth 1 should pretty much catch everything residing within... (4 Replies)
Discussion started by: stevensw
4 Replies

7. Shell Programming and Scripting

sed in windows does not parse curly braces

Hi everyone: I'm stuck at this point, could you guys please give me some hints about what I am doing wrong in the following script, I'm using sed for windows: sed ^"$ {^ a^ STRINGTABLE DISCARDABLE^ BEGIN^ #define CLIENT_MODULE, "%CLIENT_MODULE%"^ #define CLIENT_ID, "%CLIENT_ID%"^... (1 Reply)
Discussion started by: edgarvm
1 Replies

8. Shell Programming and Scripting

Help me to find files in a shell script with any matching pattern

Hi friends.. I have many dirs in my working directory. Every dir have thousands of files (.jsp, .java, .xml..., etc). So I am working with an script to find every file recursively within those directories and subdirectories ending with .jsp or .java which contains inside of it, the the pattern... (3 Replies)
Discussion started by: hnux
3 Replies

9. Shell Programming and Scripting

sed to remove braces from a file

i need to search for user belonging to group 'macusr' and the extract the user name . i am able to write a oneliner for this using awk + sed + tr i am using tr to chop off '()' from the output. but i want to use it in sed itself . can someone please help me with that file contents ... (7 Replies)
Discussion started by: chidori
7 Replies

10. Shell Programming and Scripting

Curly braces in sed

Hi, I have below command in one of the script. Can you please let me know what does the curly braces do over here \{1,\}. The remaining part of the code atleast I am able to understand. sed -n 's/.*\-\()\{1,\}\)\-.*/\1/p' (13 Replies)
Discussion started by: tostay2003
13 Replies
RCORDER(8)						    BSD System Manager's Manual 						RCORDER(8)

NAME
rcorder -- print a dependency ordering of interdependent files SYNOPSIS
rcorder [-k keep] [-s skip] file ... DESCRIPTION
The rcorder utility is designed to print out a dependency ordering of a set of interdependent files. Typically it is used to find an execu- tion sequence for a set of shell scripts in which certain files must be executed before others. Each file passed to rcorder must be annotated with special lines (which look like comments to the shell) which indicate the dependencies the files have upon certain points in the sequence, known as ``conditions'', and which indicate, for each file, which ``conditions'' may be expected to be filled by that file. Within each file, a block containing a series of ``REQUIRE'', ``PROVIDE'', ``BEFORE'' and ``KEYWORD'' lines must appear. The format of the lines is rigid. Each line must begin with a single '#', followed by a single space, followed by ``PROVIDE:'', ``REQUIRE:'', ``BEFORE:'', or ``KEYWORD:''. No deviation is permitted. Each dependency line is then followed by a series of conditions, separated by whitespace. Multi- ple ``PROVIDE'', ``REQUIRE'', ``BEFORE'' and ``KEYWORD'' lines may appear, but all such lines must appear in a sequence without any interven- ing lines, as once a line that does not follow the format is reached, parsing stops. The options are as follows: -k Add the specified keyword to the ``keep list''. If any -k option is given, only those files containing the matching keyword are listed. -s Add the specified keyword to the ``skip list''. If any -s option is given, files containing the matching keyword are not listed. An example block follows: # REQUIRE: networking syslog # REQUIRE: usr # PROVIDE: dns nscd This block states that the file in which it appears depends upon the ``networking'', ``syslog'', and ``usr'' conditions, and provides the ``dns'' and ``nscd'' conditions. A file may contain zero ``PROVIDE'' lines, in which case it provides no conditions, and may contain zero ``REQUIRE'' lines, in which case it has no dependencies. There must be at least one file with no dependencies in the set of arguments passed to rcorder in order for it to find a starting place in the dependency ordering. DIAGNOSTICS
The rcorder utility may print one of the following error messages and exit with a non-zero status if it encounters an error while processing the file list. Requirement %s has no providers, aborting. No file has a ``PROVIDE'' line corresponding to a condition present in a ``REQUIRE'' line in another file. Circular dependency on provision %s, aborting. A set of files has a circular dependency which was detected while processing the stated con- dition. Circular dependency on file %s, aborting. A set of files has a circular dependency which was detected while processing the stated file. SEE ALSO
rc(8) HISTORY
The rcorder utility first appeared in NetBSD 1.5. AUTHORS
Written by Perry E. Metzger <perry@piermont.com> and Matthew R. Green <mrg@eterna.com.au>. BUGS
The ``REQUIRE'' keyword is misleading: It doesn't describe which daemons have to be running before a script will be started. It describes which scripts must be placed before it in the dependency ordering. For example, if your script has a ``REQUIRE'' on ``named'', it means the script must be placed after the ``named'' script in the dependency ordering, not necessarily that it requires named(8) to be started or enabled. BSD
August 5, 2011 BSD
All times are GMT -4. The time now is 01:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy