Sponsored Content
Full Discussion: Delete strings in a file
Top Forums Shell Programming and Scripting Delete strings in a file Post 302144515 by fpmurphy on Thursday 8th of November 2007 03:04:53 PM
Old 11-08-2007
here is another solution based on the fact that the y command can take a
newline on the RHS.

sed -e 's/\<string\>//g' -e 's/\<\/string\>/~/g' -e 'y/~/\n/' infile > outfile
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

recursively delete the text between 2 strings from a file

i have 200000bytes size of a unix file i need to delete some text between two strings recursively using a loop with sed or awk . these two strings are : 1st string getting from a file :::2 nd string is fi...its constant . can anyone help me sed -n'/<1 st string >/,/fi/' <input_filename> is the... (2 Replies)
Discussion started by: santosh1234
2 Replies

2. Shell Programming and Scripting

Delete Strings that are present in another file

HI, if a String is present in file1.txt, i want to delete that String from file2.txt. How can i do this?? I am sure that the file1.txt is a subset of file2.txt. (2 Replies)
Discussion started by: jathin12
2 Replies

3. UNIX for Dummies Questions & Answers

Delete strings in file1 based on the list of strings in file2

Hello guys, should be a very easy questn for you: I need to delete strings in file1 based on the list of strings in file2. like file2: word1_word2_ word3_word5_ word3_word4_ word6_word7_ file1: word1_word2_otherwords..,word3_word5_others... (7 Replies)
Discussion started by: roussine
7 Replies

4. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

5. Shell Programming and Scripting

Delete chunk of text if contains certain strings

Using awk how to delete chunk of text if it contains certain strings? As in the following, delete a reference chunk, i.e. everything from <reference attribute = "value"> to </reference> inclusive, if within it "Group ID" value is 7 or 96 or 103 or 1005. <reference attribute = "value"> ... (3 Replies)
Discussion started by: pioavi
3 Replies

6. Shell Programming and Scripting

Delete 2 strings from 1 line with sed?

Hi guys, I wonder if it's possible to search for a line containing 2 strings and delete that line and perhaps replace the source file with already deleted line(s). What I mean is something like this: sourcefile.txt line1: something 122344 somethin2 24334 45554676 line2: another something... (6 Replies)
Discussion started by: netrom
6 Replies

7. Shell Programming and Scripting

Delete lines starting with these strings

Platform : RHEL 5.8 I have text file called myapplication.log . In this file, I have around 800 lines which start with the followng three strings PWRBRKER-3493 PWRBRKER-7834 SCHEDULER-ERROR How can I delete these lines in one go ? (13 Replies)
Discussion started by: omega3
13 Replies

8. Shell Programming and Scripting

How to delete strings in a file?

hi, i have a big file like this: >s31 length=12 numreads=6 gene=isotig454 status=igo ldfddfdfdfdkkkkkkfdfdkkkksdfdkkkkkkkkkksdfd dfdfdfldfdkdffdlfddflfdjkkkkkkfdgkkgfhghfgkkk ldfddfdfdfdkkkkkkfdfdkkkksdfdkkkkkkkkkksdfd dfdfdfldfdkdffdlfddflfdjkkkkkkfdgkkgfhghfgkkk >c2 length =344... (4 Replies)
Discussion started by: the_simpsons
4 Replies

9. UNIX for Dummies Questions & Answers

Delete specific strings in a file

Hi, My file has a numerous sttrings.I want to retain those strings which start with stt and delete entries with >C For eg: my infile is >C4603985... (7 Replies)
Discussion started by: sa@@
7 Replies

10. UNIX for Beginners Questions & Answers

Use strings from nth field from one file to match strings in entire line in another file, awk

I cannot seem to get what should be a simple awk one-liner to work correctly and cannot figure out why. I would like to use patterns from a specific field in one file as regex to search for matching strings in the entire line ($0) of another file. I would like to output the lines of File2 which... (1 Reply)
Discussion started by: jvoot
1 Replies
MEWENCODE(1)                                                  General Commands Manual                                                 MEWENCODE(1)

NAME
mewencode, mewdecode, mewcat - MIME encoder/decoder SYNOPSIS
mewencode [-options] [infile [outfile]] mewdecode [-options] [infile [outfile]] mewcat [-options] [infile] DESCRIPTION
The mewencode utility encode/decode MIME objects. The options are as follows: -e Encoding. -d Decoding. -8 See if any 8bit characters are contained. -b MIME base64 en/decoding. -q MIME quoted-printable en/decoding. -g MIME gzip64 en/decoding(not yet specified in RFC). -z The same as -g. -u Uudecoding. -l length Line length into which base64/quoted-printable/gzip64 encoding truncate. -t On base64/gzip64 encoding, local newline is treated as CRLF. On base/gzip64 decoding, any newline is translated into local new- line. Specify this option only when the input is a line based object(e.g. Content-Type: is text/plain or application/postscript). -h Display this help message. -v Display the version. 4th Berkeley Distribution March 17, 2001 MEWENCODE(1)
All times are GMT -4. The time now is 04:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy