Vi editor deleting lines with specific pattern


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Vi editor deleting lines with specific pattern
# 1  
Old 02-20-2014
Vi editor deleting lines with specific pattern

Hi,

I need to delete all lines in the file using vi editor which start with word aternqaco.


Please assist.

Code:
aternqaco.__oracle_base='/amdbqa01/app/oracle'#ORACLE_BASE set from environment
aternqa.__oracle_base='/amdbqa01/app/oracle'#ORACLE_BASE set from environment
aternqaco.__pga_aggregate_target=167772160
aternqa.__pga_aggregate_target=167772160
aternqaco.__sga_target=499122176
aternqa.__sga_target=838860800
aternqaco.__shared_io_pool_size=0
aternqa.__shared_io_pool_size=0
aternqaco.__shared_pool_size=339738624
aternqa.__shared_pool_size=230686720
aternqaco.__streams_pool_size=0
aternqa.__streams_pool_size=8388608


Best regards,
Vishal
# 2  
Old 02-20-2014
When you are in the command mode.
Input these
:g/^aternqaco\./d
This User Gave Thanks to Lucas_0418 For This Post:
# 3  
Old 02-20-2014
Or you can just use sed:
Code:
sed '/^aternqaco\./d' infile >tmpFile

This User Gave Thanks to chacko193 For This Post:
# 4  
Old 02-20-2014
..... or grep
Code:
grep -v "^aternqaco\." infile > outfile



Robin

Last edited by rbatte1; 02-20-2014 at 01:15 PM.. Reason: Added the trailing dot to the expression
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help required deleting specific lines from file

Hi, I have a file with 20 columns of data and hundreds of lines of the same format. Here is an example line. The data repeats underneath with the same format. 15 1 4 GLY - 1 65 LYSH 23 N - 24 H - 634 O 0.188 157.552 487 48.70I have been sorting this data by hand but I was wondering if I... (3 Replies)
Discussion started by: livbaddeley
3 Replies

2. Shell Programming and Scripting

selecting and deleting specific lines with condition

I have a set of data as below: The first field, $1 represent "|". The $3 (3rd field) and $6 (6th field) in my data file represent "number-molecule" which has arrangement as below: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ... (9 Replies)
Discussion started by: vjramana
9 Replies

3. Shell Programming and Scripting

Deleting specific lines in a file

Hello, I have a file filled with dates, such as: 04-08-2011 message 04-08-2011 message 03-08-2011 message 01-08-2011 message 31-07-2011 message 24-07-2011 message 15-07-2011 message 13-12-2008 message 26-11-2007 message And I want to delete those lines whose date is older than 10... (5 Replies)
Discussion started by: asanchez
5 Replies

4. Shell Programming and Scripting

deleting specific lines in a file

Hello, I have a file like: 26-07-2011 sunz02 message1 26-07-2011 sunz02 message2 26-07-2011 sunz02 message3 15-07-2011 sunz02 message1 15-07-2011 sunz02 message2 15-07-2011 sunz02 message3... (5 Replies)
Discussion started by: asanchez
5 Replies

5. Shell Programming and Scripting

Deleting specific lines in a file

Hello, I have a file like this one: 03-07-2011 sunz02 message1 03-07-2011 sunz02 message2 03-07-2011 sunz02 message3 01-07-2011 sunz02 message1 01-07-2011 sunz02 message2 01-07-2011 sunz02 ... (1 Reply)
Discussion started by: asanchez
1 Replies

6. Shell Programming and Scripting

deleting specific lines in a file

I want to delete all lines from a file (orig_file) that contain the regex values (bad_inv_list) I tried a for each loop with sed but it isn't working for file in `cat bad_inv_list`; do sed '/$file/d' orig_file > pared_down_file.1 mv pared_down_file.1 orig_file done I've added... (2 Replies)
Discussion started by: verge
2 Replies

7. Shell Programming and Scripting

awk : deleting specific incorrect lines

Hello friends, I searched in forums for similar threads but what I want is to have a single awk code to perform followings; I have a big log file going like this; ... 7450494 1724465 -47 003A98B710C0 7450492 1724461 -69 003A98B710C0 7450488 1724459 001DA1915B70 trafo_14:3 7450482... (5 Replies)
Discussion started by: enes71
5 Replies

8. Shell Programming and Scripting

Shell deleting specific lines

Hi, I'am working under unix solaris I have a text file with set of lines, each set of lines (BLOCK) have three fixed lines : Between SECND line and THEND we have N lines, N differ from a block to another sample : i have to make a script wich delete each 3 fixed lines if N=0... (3 Replies)
Discussion started by: salbanito
3 Replies

9. UNIX for Dummies Questions & Answers

deleting specific lines from all files in a directory

I have a directory full of text data files. Unfortunately I need to get rid of the 7th and 8th line from them all so that I can input them into a GIS application. I've used an awk script to do one at a time but due to the sheer number of files I need some kind of loop mechanism to automate... (3 Replies)
Discussion started by: vrms
3 Replies

10. Shell Programming and Scripting

Deleting specific lines in a file

I have a file which has some lines starting with a particular word. I would like to delete 5 lines before each such line containing that particular word. eg: line1 line2 line3 line4 line5 line6 "particular word"... I would like to delete line2-line6 and all such occurences in that... (4 Replies)
Discussion started by: ramu_1980
4 Replies
Login or Register to Ask a Question