Sponsored Content
Top Forums UNIX for Dummies Questions & Answers delete lines matching a regular expression Post 302604716 by pathunkathunk on Monday 5th of March 2012 07:22:50 PM
Old 03-05-2012
Thanks but this doesn't seem to work for me.

I tried it on my large file and did not notice a difference. Then I created a smaller test file of only 6 lines, ensuring that I used the tab key to indent every other line. Still, the output file was identical to the input.

command: sed '/^\t/ d' test2 >test2b

#test2
abc1
abc2
ab3
abc4
abc5

#test2b
abc1
abc2
ab3
abc4
abc5
 

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
SCHLEUDER-NEWLIST(8)													      SCHLEUDER-NEWLIST(8)

NAME
schleuder-newlist - create new Schleuder mailing list SYNOPSIS
schleuder-newlist [-c baseconfig] newlist@example.net [-realname "Foo List"] [-adminaddress listadmin@example.net] [-initmember member1@example.net -initmemberkey path-to-initmember-publickey] [-privatekeyfile path-to-privatekey -publickeyfile path-to-publickey -passphrase "key passphrase"] [-mailuser schleuder] [-nointeractive] DESCRIPTION
schleuder-newlist automates the creation of new Schleuder mailing lists. For more information on Schleuder, please look at schleuder(8). schleuder-newlist does various input validation, and can generate a key or import one. It will give you as well an easy interface to build new lists in a scripted manner. It also supports an interactive mode, with which the user will be prompted for missing mandatory options. The interactive mode can be dis- abled, using the -nointercative flag; it is automatically disabled if the script isn't run within a valid tty. If no -privatekeyfile, -publickeyfile and -passphrase are provided, the list will create a new keypair with a random password. The type and length of the generated keypair is specified in /etc/schleuder/schleuder.conf. OPTIONS
-c path-to-schleuder-configuration: Specify an alternate configuration directory than the default /etc/schleuder. -realname "Foo List" Specify the name of the mailing list. -adminaddress listadmin@example.net Specify the email address of a list administrator. This address will be notified of errors, and depending on configuration may also be allowed to send restricted email commands. -initmember member1@example.net Specify the first subscribed list member address. Can be the same as the administrator address. This option must be accompanied by -initmemberkey. -initmemberkey path-to-initmember-publickey Specify the path to first subscribed list member public key. -initmember must also be specified. -privatekeyfile path-to-privatekey Specify the path to a previously-generated private key for the list. This option must be accompanied by -publickeyfile and -passphrase. -publickeyfile path-to-publickey Specify the path to a previously-generated public key for the list. This option must be accompanied by -privatekeyfile and -passphrase. -passphrase "key passphrase" Specify the passphrase needed to access the private key specified in -privatekeyfile. This option must be accompanied by -publickey- file as well. -mailuser schleuder Specify the system user account under which schleuder(8) will be executed (when run as root, this defaults to schleuder). -nointeractive When specified, no questions will be asked to complete missing information. EXAMPLES
This creates a new list called test1 with the initial member foo@bar.ch. A new keypair will be generated for the list. schleuder-newlist foobar@example.org -realname "bal jak" -adminaddress admin@example.org -initmember foo@example.com -initmemberkey /tmp/foo.pub The list test2 will be created, a keypair from the following files with the passphrase test will be imported. schleuder-newlist test2@example.com -realname "bal jak" -adminaddress foobar@example.org -privatekeyfile ~/tmp/test2.priv -publickeyfile /tmp/test2.pub -passphrase test FILES
/etc/schleuder/schleuder.conf global Schleuder configuration /etc/schleuder/default-list.conf default list settings /var/schleuderlists/HOSTNAME/LISTNAME list internal data /var/schleuderlists/HOSTNAME/LISTNAME/list.conf list settings /var/schleuderlists/HOSTNAME/LISTNAME/members.conf list susbcribers All configuration files are formatted as YAML. See http://www.yaml.org/ for more details. BUGS
Known bugs are listed on the Schleuder website. SEE ALSO
schleuder(8), aliases(5), gnupg(7). Schleuder website http://schleuder.nadir.org/ YAML website http://www.yaml.org/ June 2012 SCHLEUDER-NEWLIST(8)
All times are GMT -4. The time now is 02:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy