Del Line if specific issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Del Line if specific issue
# 1  
Old 07-11-2013
Del Line if specific issue

HI Guys

I have below input :
Code:
PO 121255 SorkO_RM_,rlsmel=310_410_3_11104_43831
PO 125564 SorkO_RM_,rlsmel=007G43823

I want delete line which have "_" after = Sign

Output :

Code:
PO 125564 SorkO_RM_,rlsmel=007G43823

# 2  
Old 07-11-2013
Code:
grep -v "=.*_" file

# 3  
Old 07-11-2013
Code:
cat file
PO 121255 SorkO_RM_,rlsmel=310_410_3_11104_43831
PO 125564 SorkO_RM_,rlsmel=007G43823

sed -i '/.*=.*_/d' file

cat file
PO 125564 SorkO_RM_,rlsmel=007G43823

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Del: line 13: syntax error: unexpected end of file

1 echo -e "Enter a filename" 2 read filename 3 if 4 then 5 echo -e "do you want to delete?" 6 read answer 7 if 8 then rm myfirst 9 else 10 echo -e "file not deleted" 11 fi 12 exit0 (1 Reply)
Discussion started by: Speedy
1 Replies

2. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

3. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

4. Shell Programming and Scripting

Commenting a specific line and inserting a new line after commented line.

Hello All, I have following file contents cat file #line=aaaaaa #line=bbbbbb #line=cccccc #line=dddddd line=eeeeee #comment=11111 #comment=22222 #comment=33333 #comment=44444 comment=55555 Testing script Good Luck! I would like to comment line line=eeeeee and insert a new line... (19 Replies)
Discussion started by: manishdivs
19 Replies

5. Shell Programming and Scripting

Replace specific field on specific line sed or awk

I'm trying to update a text file via sed/awk, after a lot of searching I still can't find a code snippet that I can get to work. Brief overview: I have user input a line to a variable, I then find a specific value in this line 10th field in this case. After asking for new input and doing some... (14 Replies)
Discussion started by: crownedzero
14 Replies

6. Shell Programming and Scripting

Using awk to read a specific line and a specific field on that line.

Say the input was as follows: Brat 20 x 1000 32rf Pour 15 p 1621 05pr Dart 10 z 1111 22xx My program prompts for an input, what I want is to use the input to locate a specific field. Like if I type in, "Pou" then it would return "Pour" and just "Pour" I currently have this line but it is... (6 Replies)
Discussion started by: Bungkai
6 Replies

7. Shell Programming and Scripting

perform some operation on a specific coulmn starting from a specific line

I have a txt file having rows and coulmns, i want to perform some operation on a specific coulmn starting from a specific line. eg: 50.000000 1 1 1 1000.00000 1000.00000 50000.000 19 19 3.69797533E-07 871.66394 ... (3 Replies)
Discussion started by: shashi792
3 Replies

8. Shell Programming and Scripting

del the line before the "abc"line and after it

$file1 haha hello i'm lei i'm abc you are right yes it is I want to get file2 haha i'm abc yes it is del line before and after the line contains abc I want to know the two steps 1,del the line before line "abc' ,2 del the line after the "abc question 2 (4 Replies)
Discussion started by: yanglei_fage
4 Replies

9. Shell Programming and Scripting

using sed to replace a specific string on a specific line number using variables

using sed to replace a specific string on a specific line number using variables this is where i am at grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean grep -n Destination... (2 Replies)
Discussion started by: todd.cutting
2 Replies

10. UNIX for Dummies Questions & Answers

del blank line after each line

i am a rookie when it comes to unix. 123 1234 12345 123456 1234567 12345678 (1 Reply)
Discussion started by: tjmannonline
1 Replies
Login or Register to Ask a Question