Sponsored Content
Top Forums Shell Programming and Scripting SED - adding blank line after each Range Match Post 302324427 by radoulov on Wednesday 10th of June 2009 04:27:02 PM
Old 06-10-2009
Quote:
Originally Posted by danmauer
[...]1. i don't want to catch occurences of where select is part of word, (e.g. selection)

2. i want to catch when select is the only word on the line.

3. i want to catch when select is not the only word on the line, and is followed by a space

Some sed implementations support word boundaries:

Code:
/\<[Ss][Ee][Ll][Ee][Cc][Tt]\>/

Or just use a more powerful tool (e.g. Perl).

Last edited by radoulov; 06-10-2009 at 05:36 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

adding blank line in egrep

I followed the egrep example given in the thread "parse text or complex grep ?". It is exactly what I need...except... how do I insert a blank line after the second line? My exact command is: egrep 'patt1|patt2' filename the result is: patt1 patt2 patt1 patt2 and so on. I would... (2 Replies)
Discussion started by: antalexi
2 Replies

2. Shell Programming and Scripting

Need help in sed command (adding a blank line btw each block generated by pattern)

Hello friends, I have a C source code containing sql statements. I use the following sed command to print all the sql blocks in the source code.... sed -n "/exec sql/,/;/p" Sample.cpp The above sed command will print the sql blocks based on the pattern "exec sql" & ";"... (2 Replies)
Discussion started by: frozensmilz
2 Replies

3. Shell Programming and Scripting

Fill the empty line by adding line before blank line

FIle A "A" 2 aa 34 3 ac 5 cd "B" 3 hu 67 4 fg 5 gy output shud be A"" 2 aa 34 "A" 3 ac 34 "A" 5 cd 34 "B" 3 hu 67 "B" 4 fg 67 "B" 5 gy 67 (6 Replies)
Discussion started by: cdfd123
6 Replies

4. Shell Programming and Scripting

Awk script to match pattern till blank line

Hi, I need to match lines after a pattern, upto the first blank line. Searched in web and some forums but coulnt find the answer. where <restart_step> = 10 -- Execute query 20 -- Write the contents to the Oracle table 30 -- Writing Contents to OUTPUT... (7 Replies)
Discussion started by: justchill
7 Replies

5. Shell Programming and Scripting

Adding a blank line after every 5th line

Hello... I have a file which contain certain number of records. I want to generate another file from this file which will contain 1st line as a blank line & after every 5 lines one blank line will be inserted. How to achieve this through shell scripting? Thanks... (5 Replies)
Discussion started by: 46019
5 Replies

6. Shell Programming and Scripting

sed adding a blank line

I use the following as part of a script to correct for a faulty hostname file. # get the domain name read -r thehostname < /etc/hostname dom="$(echo $thehostname | cut -d'.' -f2)" numchar=${#dom} if then echo "It appears as though the hostname is not correctly set." echo "Hostname has... (5 Replies)
Discussion started by: bugeye
5 Replies

7. Shell Programming and Scripting

Sed delete blank lines upto first pattern match

Hi Im trying to do the following in sed. I want to delete any blank line at the start of a file until it matches a pattern and then stops. for example: Input output: I have got it to work within a range of two patterns with the following: sed '/1/,/pattern/{/^]*$/d}' The... (2 Replies)
Discussion started by: duonut
2 Replies

8. Shell Programming and Scripting

sed one Liner inverse range match-help required

cat test.txt a c d e g (2 Replies)
Discussion started by: TomG
2 Replies

9. Shell Programming and Scripting

Adding a blank line in between two O/Ps in tabular format which gets received over email

Hi Guys, I am stuck in between and seeking help here. Requirement: A script that will run every morning which will connect to Mysql database and run the query to inform us about the holidays (it will also check if there were any holidays during last 2 business days). So the three queries are... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies

10. Shell Programming and Scripting

Get range out using sed or awk, only if given pattern match

Input: START OS:: UNIX Release: xxx Version: xxx END START OS:: LINUX Release: xxx Version: xxx END START OS:: Windows Release: xxx Version: xxx ENDHere i am trying to get all the information between START and END, only if i could match OS Type. I can get all the data between the... (3 Replies)
Discussion started by: Dharmaraja
3 Replies
PMKSYNTAX(5)						      BSD File Formats Manual						      PMKSYNTAX(5)

NAME
PMK Syntax -- PMK files syntax manual DESCRIPTION
This manual page describe the basic syntax used in PMK files such as pmkfile and scanfile DATA TYPES
PMK uses pseudo types like the following: bool The classical boolean type with TRUE and FALSE values. For example: TRUE FALSE identifier An identifier is a string of alphanumerical and underscores characters. For example: REQUIRED a_label underscores_are_nice quoted This means quoted string which can contain a set of characters delimited by quotation marks. For examples: "simple quoted string" "string that contain "quotes" backslashed" "can also contain filenames like pmkfile.scan" list It is one or more of the previous types between brackets. Multiple objects are separated with a comma. Blanks are currently not allowed beside commas, this means that you can find them only in a quoted string of the list. For example: ("only_one_string") ("added a boolean",TRUE) (mixed_list_of,"words","and",TRUE,"quoted strings") BASIC SYNTAX
PMK can contain comments, blank lines and commands. A command has the following format (? character means optional field): <command><?(label)> { <body> } The command and label names can be assimilated to the 'word' type. See DATA TYPES above. The body can contain comment(s) and definition line(s). A commented line start with a '#' character like the following: # this is a comment line A definition line has the following format: <?blank><key name><?blank>=<?blank><key value> The key name is of identifier type. The key value type can be 'bool', 'quoted' or 'list'. The right type will depend on the key name (see further). For example: CHECK_INCLUDE(header_sys_param) { # following options use different uses of blank characters # key value is word type REQUIRED = TRUE # key value is list type DEPEND= ("dep_one",dep_two,"dep_three") # key value is quoted type INCLUDE = "sys/param.h" } SEE ALSO
pmkfile(5), scanfile(5) BSD
November 5, 2005 BSD
All times are GMT -4. The time now is 10:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy