Sponsored Content
Top Forums UNIX for Dummies Questions & Answers delete lines matching a regular expression Post 302604694 by birei on Monday 5th of March 2012 05:17:17 PM
Old 03-05-2012
Hi pathunkathunk,

This sed command will delete all lines that begin with a tab character. I think this is what you want, if I understood your question. And it should be very fast processing that big file.
Code:
$ sed '/^\t/ d' infile

EDIT to add the command that redirects output:
Code:
$ sed '/^\t/ d' infile >outfile

 

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
GAUCHE-CESCONV(1)						  Gauche Commands						 GAUCHE-CESCONV(1)

NAME
gauche-cesconv - convert text from one character encoding scheme to another SYNOPSIS
gauche-cesconv [-h] [-f encoding] [-t encoding] [-o outfile] [infile] DESCRIPTION
The gauche-cesconv command is a program to convert text from one character encoding scheme (CES) to another, using Gauche's character conversion module. Hence the supported character sets are the same as Gauche's. See the info document of Gauche for more details. There are other commands that provide the same functionality and more, such as iconv(1) or nkf(1), but they are not universally available by default. This command is provided for Gauche's external packages to ease the installation and configuration process; for those packages, it is certain that gauche-cesconv is available, so they don't need to check availability of iconv etc. When infile is omitted, the text is read from standard input. OPTIONS
-f, --from-code=encoding Selects input encoding. Can be '*JP' to guess the character encoding from japanese text, among either ISO2022-JP(-1,2,3), EUCJP, SHIFT_JIS or UTF-8. If omitted, gauche's native CES is used. -h, --help Show summary of options. -o, --output=outfile Place output in file outfile. If omitted the converted text is written to standard output. -t, --to-code=encoding Selects output encoding. (see also --from-code) DIAGNOSTICS
gauche-cesconv exits with status 0 on success. SEE ALSO
gauche-package(1), iconv(1) The program will be documented fully by the Gauche Developers' Reference available via the info(1) system. AUTHORS
Shiro Kawai <shiro@acm.org> Author. Jens Thiele <karme@karme.de> Wrote this manpage for the Debian system. COPYRIGHT
Copyright (C) 2010 Jens Thiele Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty. Gauche 0.9.1 GAUCHE-CESCONV(1)
All times are GMT -4. The time now is 05:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy