Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Removing PATTERN from txt without removing lines and general text formatting Post 302918510 by junior-helper on Tuesday 23rd of September 2014 08:09:42 PM
Old 09-23-2014
Quote:
Originally Posted by Don Cragun
Code:
sed 's/ -- //g' file.txt > newfile.txt

It is very likely that there will be more than one occurrence of -- per line, thus I added a "g" for global replacement. Just in case.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing lines in a text file.

Here is my problem I'm hoping you guru's can help me figure out. I have a text file that contains comma delimited columns. What I'm looking to do is see if the 24th column on each row in the file contains a value (not null), and then write/append that line to a different file. I've been... (4 Replies)
Discussion started by: WABonnett
4 Replies

2. Solaris

removing particular lines ending with a .cnt extension in a text file

I have a text file with rows of information (it is basically a ls command information(o/p from ls command)) I need to remove the lines ending with a .cnt extension and keep the lines ending with .zip extension, how to accomplish this. I also only need the date,size and name of the file from every... (2 Replies)
Discussion started by: ramky79
2 Replies

3. Shell Programming and Scripting

removing pattern which is spread in multiple lines

I have several huge files wich contains oracle table creation scripts as follows: I would need to remove the pattern colored in red above. Any sed/awk/pearl code will be of much help. Thanks (2 Replies)
Discussion started by: sabyasm
2 Replies

4. Shell Programming and Scripting

Script for removing text from a txt file

Hello, So I wanted to write a very simple script to remove some information from a text file and save it as something else. For example I have a text file (let's call it txt) with three rows of numbers: 0 0 1 9 8 7 5 0 6 7 9 0 0 7 9 8 1 1 6 4 0 6 0 0 9 8 4 6 0 9 2 8 1 And I want to... (2 Replies)
Discussion started by: hertingm
2 Replies

5. UNIX for Dummies Questions & Answers

removing multiple lines of text in a file

Hi, I'm trying to remove multiple lines of text based off a series of different words and output it to a new file The document contains a ton of data but i want to delete any line that has the following mx1.rr.biz.com or ns2.ri.biz.com i tried using grep -v filename "mx1.rr.biz.com" >... (3 Replies)
Discussion started by: spartan22
3 Replies

6. Shell Programming and Scripting

removing lines around a matched pattern

I have an ugly conf file that has the string I'm interested in searching for in the middle of a block of code that's relevant, and I'm trying to find a way to remove that entire block based on the matched line. I've googled for this problem, and most people helping are only interested in... (9 Replies)
Discussion started by: tamale
9 Replies

7. Shell Programming and Scripting

Removing all lines prior to the last pattern in a file/stream

Hi all, I didn't find anything that specifically answers this after searching for a bit, so please forgive me if this has been covered before. I'm looking to delete all lines prior to the last occurrence of a string in a file or stream from within a shell script (bash.) A bit of... (4 Replies)
Discussion started by: LivinFree
4 Replies

8. UNIX for Dummies Questions & Answers

Removing trailing lines at the end of a text file

How do you remove trailing empty lines at the end of a text file? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies

9. Shell Programming and Scripting

removing lines without text

How do I remove line that do not contain text, but that do contain tabs? I have tried the command cat file | awk NF but that doesn't work when the lines contain tabs (and spaces). I have also tried: cat file | sed '/^$/d' (9 Replies)
Discussion started by: locoroco
9 Replies

10. Shell Programming and Scripting

Removing md5sum lines stored in text file

Hello. I'm writing a script where every file you create will generate a md5sum and store it into a text file. Say I create 2 files, it'll look like this in the text file: d41d8cd98f00b204e9800998ecf8427e /helloworld/saystheman d41d8cd98f00b204e9800998ecf8427e /helloworld/test I... (3 Replies)
Discussion started by: batarangs_
3 Replies
Text::WordDiff::ANSIColor(3pm)				User Contributed Perl Documentation			    Text::WordDiff::ANSIColor(3pm)

Name
       Text::WordDiff::ANSIColor - ANSI colored formatting for Text::WordDiff

Synopsis
	   use Text::WordDiff;

	   my $diff = word_diff 'file1.txt', 'file2.txt';
	   my $diff = word_diff $string1,   $string2,   { STYLE => 'ANSIColor' };
	   my $diff = word_diff *FH1,	     *FH2;	  \%options;
	   my $diff = word_diff &reader1,   &reader2;
	   my $diff = word_diff @records1,  @records2;

	   # May also mix input types:
	   my $diff = word_diff @records1,  'file_B.txt';

Description
       This class subclasses Text::WordDiff::Base to provide a formatting class for Text::WordDiff that uses ANSI-standard terminal escape
       sequences to highlight deleted and inserted text. This formatting class is the default class used by Text::WordDiff; see its documentation
       for details on its interface. This class should never be used directly.

       Text::WordDiff::ANSIColor formats word diffs for viewing in an ANSI-standard terminal session. The diff content is highlighted as follows:

       Deletes
	   Deleted words will display in bold-faced red. The ANSI standard for strikethrough is also used, but since it is not supported by most
	   terminals, likely will not show up.

       Inserts
	   Inserted words will display in bold-faced, underlined green.

       All other content is simply returned.

See Also
       Text::WordDiff
       Text::WordDiff::HTML

Support
       This module is stored in an open repository at the following address:

       <https://svn.kineticode.com/Text-WordDiff/trunk/>

       Patches against Text::WordDiff are welcome. Please send bug reports to <bug-text-worddiff@rt.cpan.org>.

Author
       David Wheeler <david@kineticode.com>

Copyright and License
       Copyright (c) 2005-2008 David Wheeler. Some Rights Reserved.

       This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

perl v5.10.0							    2009-09-24					    Text::WordDiff::ANSIColor(3pm)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy