delete strings till specific string


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting delete strings till specific string
# 1  
Old 11-01-2008
delete strings till specific string

Hello
i want to know a way so i can delete all the strings in file from the begning till a specific string

Last edited by modcan; 11-02-2008 at 04:40 AM..
# 2  
Old 11-01-2008
One way with awk, the slashes are escaped and the quote is replaced with the octal number 047:

Code:
awk '
/* MAILBOX \047\/mboxes\/4\/162\/123\/600004903@orange.es\// {p=1;next}
p' file > newfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

How to delete lines starting with specific string?

Dear all, I would like to delete even lines starting with "N" together with their respective titles which are actually odd lines. Below is the example of input file. I would like to remove line 8 and 12 together with its title line, i.e., line 7 and 11, respectively.... (2 Replies)
Discussion started by: huiyee1
2 Replies

3. Shell Programming and Scripting

Delete column with exact string in specific col

Hi, my file structur looks like File structure looks: GeneID protein_gi Symbol 1246500 10954455 repA1 1246501 10954457 repA2 1246502 10954458 leuA But some of the cases do not have record for protein id. for example: 1343044 - orf01 I want to remove those rows. But I tried awk... (9 Replies)
Discussion started by: smitra
9 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. UNIX for Dummies Questions & Answers

Delete all rows that contain a specific string (text)

Hi, I have a text file and I want to delete all rows that contain a particular string of characters. How do I go about doing that? Thanks! (9 Replies)
Discussion started by: evelibertine
9 Replies

6. Shell Programming and Scripting

Html parsing - get line after specific string till a point

Hi all :) It sounds complex, for example I want to find the whole html file (there are 5 entries of this string and I need to get all of them) for the string "<td class="contentheading" width="100%">", get the next line from it only till the point that says "</td>", plus removing \t (tabs) ... (6 Replies)
Discussion started by: hakermania
6 Replies

7. Shell Programming and Scripting

Bash take word after specific point and till next space?

Hello, I have an output like Interface Chipset Driver wlan0 Intel 4965/5xxx iwlagn - and I want to take only the 'wlan0' string. This can be done by a="Interface Chipset Driver wlan0 Intel 4965/5xxx iwlagn - " b=${a:25:6} echo $bThe thing is that wlan0 can be something else, like eth0 or... (2 Replies)
Discussion started by: hakermania
2 Replies

8. 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

9. Shell Programming and Scripting

SED delete string from till problems

Hi i have a file which contains 2 lines, line 1 is static data. line 2 is a very large string(over 3000char or much more). in that string are tags which i want to delete. e.g. <order1>123</order1><tag1>data</tag1><new>1</new><order2>124</order2><tag1>data</tag1> all one one line. now i... (5 Replies)
Discussion started by: subby80
5 Replies

10. UNIX for Dummies Questions & Answers

Delete line till certain point

Hi, I have a requirement to delete a line till a certain word. Am not sure how to do it e.g I want to delete till the bold character since start of line. Any help is higly appretiated. (2 Replies)
Discussion started by: inq
2 Replies
Login or Register to Ask a Question