Sponsored Content
Top Forums UNIX for Dummies Questions & Answers delete lines matching a regular expression Post 302604820 by Scrutinizer on Tuesday 6th of March 2012 04:42:09 AM
Old 03-06-2012
With older seds you cannot use "\t" and you need to do this:
Code:
sed 's/^    //d' infile

You cannot copy-paste this. The white space is one TAB-character entered as CTRL-V TAB
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regular expression matching a new line

I have written a script to test some isdn links in my network and I am trying to format the output to be more readable. Each line of the output has a different number of digits as follows... Sitename , spid1 12345678901234 1234567890 1234567 , spid2 1234567890 1234567890 1234567 Sitename , ... (1 Reply)
Discussion started by: drheams
1 Replies

2. Programming

Regular Expression matching in PERL

I am trying to read a file and capture particular lines into different strings: LENGTH: Some Content here TEXT: Some Content Here COMMENT: Some Content Here I want to be able to get (LENGTH: .... ) into one array and so on... I'm trying to use PERL in slurp mode but for some reason... (8 Replies)
Discussion started by: Legend986
8 Replies

3. Shell Programming and Scripting

Help: Regular Expression for Negate Matching String

Hi guys, as per subject I am having problem with regular expressions. Example, if i got a string "javax.servlet.http.HttpServlet.service" that may occurred anywhere within a text file. How can I used the negate pattern matching of regular expression? I tried the below pattern but it... (4 Replies)
Discussion started by: DrivesMeCrazy
4 Replies

4. Shell Programming and Scripting

Regular expression matching in BASH (equivalent of =~ in Perl)

In Perl I can write a condition that evaluates a match expression like this: if ($foo =~ /^bar/) { do blah blah blah } How do I write this in shell? What I need to know is what operator do I use? The '=~' doesn't seem to fit. I've tried different operators, I browsed the man page for... (3 Replies)
Discussion started by: indiana_tas
3 Replies

5. Shell Programming and Scripting

Regular expression matching

Hi, I have a variable in my script that gets its value from a procstack output. It could be a number of any length, or it could just be a '1' with 0 or more white spaces around it. I would like to detect when this variable is just a 1 and not a 1234, for example. This is as far as I got: ... (3 Replies)
Discussion started by: tmf33uk
3 Replies

6. Shell Programming and Scripting

How to delete the word after a regular expression

Example: Lucas RUNCYCLE Rule1 Astigmatism Robot RUNCYCLE Rule2 Jack RUNCYCLE Calendar1 June Lucy RUNCYCLE Exception4 Fear RUNCYCLE Calendar5 August In this example, how can I delete the next after the expression RUNCYCLE? (i.e. Rule1, Rule2, Calendar1, Exception1, Calendar5) I'm... (3 Replies)
Discussion started by: The Gamemaster
3 Replies

7. Shell Programming and Scripting

Matching single quote in a regular expression

I trying to match the begining of the following line in a perl script with a regular expression. $ENV{'ORACLE_HOME'} I tried this regluar expession: /\$ENV\{\'ORACLE_HOME\'\}/ Instead of match, I got a blank prompt > It seems to be a problem with the single quote. If I take it... (11 Replies)
Discussion started by: JC9672
11 Replies

8. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies

9. UNIX for Dummies Questions & Answers

Finding lines with a regular expression, replacing them with blank lines

So the tag for this forum says all newbies welcome... All I want to do is go through my file and find lines which contain a given string of characters then replace these with a blank line. I really tried to find a simple command to do this but failed. Here's what I did come up with though: ... (2 Replies)
Discussion started by: Golpette
2 Replies

10. Shell Programming and Scripting

regular expression matching whole words

Hi Consider the file this is a good line when running grep '\b(good|great|excellent)\b' file5 I expect it to match the line but it doesn't... what am i doing wrong?? (ultimately this regex will be in a awk script- just using grep to test it) Thanks, Storms (5 Replies)
Discussion started by: Storms
5 Replies
stl_key(4)						     Kernel Interfaces Manual							stl_key(4)

NAME
stl_key - setld kit manufacturing key files DESCRIPTION
Each software product that is distributed as subsets for the setld(8) command has an associated key file. The key file's name consists of the product's unique 3-letter name and a 3-digit version number with the string .k for a suffix. The key file is used by the software kit- ting program kits(1) in producing software distribution packages. A key file has a global data section and a subset descriptor section. The sections are separated by a line containing only two percent signs (%%). The global section specifies the product-level attributes of the product. In this section, lines that begin with number signs (#) are com- ments and are ignored by the kits utility. Attributes are specified as name/value pairs separated by equals signs (=). There must be no white space surrounding the equals sign. There are four mandatory attributes and two optional attributes. Attributes must have non-null values. The attributes are: NAME Mandatory. Specifies the name of the product. The value for NAME is a text string of up to 40 characters. If the string con- tains blank spaces, it must be enclosed in apostrophes (''). CODE Mandatory. Specifies the 3-character product code for the product, for example, OAT. VERS Mandatory. Specifies the 3-digit version code for the product, for example, 100. MI Mandatory. Specifies the pathname of the master inventory file for the product. ROOT Optional. A single-digit integer that is set to 1 if the product is the base operating system. In all other cases, this flag must be a zero (0). If missing, this attribute defaults to zero. COMPRESS Optional. A single-digit integer that is set to 1 to create compressed subset files using the compress(1) utility, thereby sav- ing space on the distribution media. To suppress compression, this attribute is a zero (0). If missing, this attribute defaults to zero. The subset descriptor section contains one subset descriptor line for each subset in the product. Comments are not permitted in this sec- tion. A subset descriptor contains subset-specific attributes in four fields separated by TAB characters. These fields are: Subset name A character string up to 15 characters in length, composed of the 3-letter product code (for example, OAT), a mnemonic iden- tifying the subset (for example, DCB), and the 3-digit version code (for example, 100). All letters in the subset name must be uppercase. Reserved This field must be a single period. Flags A 16-bit unsigned integer Bit 0 is the ``sticky bit,'' indicating when set that the subset cannot be removed. Bit 1 indicates when set that the subset is optional. Bits 2 to 7 are reserved. Bits 8 to 15 are undefined. Description A short description of the subset, delimited by single quotation marks (''); for example, 'Document Building Tools' The subset descriptors must be listed in the order in which the subsets are to be installed by setld. RESTRICTIONS
Comments in the subset descriptor section will cause serious problems when encountered by the kits program. TAB formatting in the subset descriptors is tightly enforced by the kits program. EXAMPLES
The following example illustrates the key file for a hypothetical product kit: # Key file for the Orpheus Document Building Tools kit # # Product-level attributes. # NAME='Orpheus Authoring Tools' CODE=OAT VERS=100 MI=OAT00.mi ROOT=0 COMPRESS=1 # # Subset def- initions follow. # %% OATDCB100 . 0 'Document Building Tools' OATDCBDOC100 . 2 'Document Tools Documenta- tion' RELATED INFORMATION
Commands: kits(1), setld(8) Files: stl_comp(4), stl_ctrl(4), stl_image(4), stl_mi(4) Documents: Guide to Preparing Product Kits delim off stl_key(4)
All times are GMT -4. The time now is 10:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy