Remove last pattern


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove last pattern
# 8  
Old 02-11-2013
Code:
awk -Fcom '{print $1FS}' file

Not a god solution.
Will not work with url like www.dotcom.com

Code:
awk -F. 'NF--' OFS=.

Right on the spot. Short and does the job.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk to remove pattern and lines above pattern

In the awk below I am trying to remove all lines above and including the pattern Test or Test2. Each block is seperated by a newline and Test2 also appears in the lines to keep but it will always have additional text after it. The Test to remove will not. The awk executed until the || was added... (2 Replies)
Discussion started by: cmccabe
2 Replies

2. Shell Programming and Scripting

How to remove the lines with this pattern?

Hello everyone, I have a sample data like this: Glyma.10G051100 Glyma.02G036000 89.91 228 23 0 1 228 1 228 1e-78 294 Glyma.10G051100 Glyma.09G023700 87.28 228 29 0 1 228 1 228 1e-68 261 Glyma.10G285200 Glyma.20G103800 96.33 1663 55 4 1 1657 1 1663 0.0 2728 Glyma.10G285200 Glyma.05G093700 95.02... (2 Replies)
Discussion started by: nengcheng
2 Replies

3. UNIX for Advanced & Expert Users

How to remove a char before a pattern?

Hi I have a file where i want to remove a char before a specific pattern. exp: CREATE TABLE ( A, B, C, ----comma needs to be removed )AS SELECT A, B, C, ----comma needs to be removed FROM TABLE. So i want to delete the comma(,) after the C both ways.Pattern can be... (11 Replies)
Discussion started by: raju2016
11 Replies

4. Shell Programming and Scripting

Search a pattern in a line and remove another pattern

Hi, I want to search a pattern in a text file and remove another pattern in that file. my text file look like this 0.000000 1.970000 F 303 - 1.970000 2.080000 VH VH + 2.080000 2.250000 VH VH + 2.250000 2.330000 VH L - 2.330000 2.360000 F H + 2.360000 2.410000 L VL - 2.410000 ... (6 Replies)
Discussion started by: sreejithalokkan
6 Replies

5. Shell Programming and Scripting

Remove all line below the pattern

I have few files i want to delete all line before match and also print the match line. like Can anyone help. (8 Replies)
Discussion started by: james1988
8 Replies

6. Shell Programming and Scripting

remove pattern with sed

Hi, i want to remove a certain pattern when i type pwd. pwd will look like this: ..../....../....../Pat_logs/..../....../...../...... the dotted lines are just random directory names, i want it to remove the "Pat_logs/...../....../....../" part so for example: ... (5 Replies)
Discussion started by: a27wang
5 Replies

7. Shell Programming and Scripting

How to remove all text except pattern

i have nasty html file with 2000+ simbols in 1 row...i need to remove whole the code except title="Some title..." and store those into file with titles (the whole text is in variable text) i've tried something like this: echo $text | sed 's/.*\(title=\".+\"\).*/\1/' > titles.html BUT it does... (13 Replies)
Discussion started by: Lukasito
13 Replies

8. Shell Programming and Scripting

How to remove a file with a particular pattern

Hi I have a list of files in a folder.I have a search pattern in the file name and i want to remove the file with that pattern.How can that be made List of files xxxxx.ID1.yyyyy.zzzzz yyyy.ID2.bbbbb.kkkkk xxxxx.ID1.yyyyy.zzzzz yyyy.ID4.bbbbb.kkkkk xxxxx.ID1.yyyyy.zzzzz... (2 Replies)
Discussion started by: sparks
2 Replies

9. UNIX for Advanced & Expert Users

Program to remove a pattern

Hi, I want to remove all occurances of a character which follows a ^ symbol. For ex: This is a Test ^H^@^@^@^@^@^@ File used in VI. ^@^@^B^VDM-BM-$|M-^_M-F^AM- In the above example, I should remove all characters which follows a ^. (^H ^@ ^B ^V etc) and It should print This is a Test... (4 Replies)
Discussion started by: arsheshadri
4 Replies

10. Shell Programming and Scripting

sed remove everything up to the pattern

I have been search all over the internet to find a solution to this. I have a file that looks like: -a ItemConfig.custom=true -a Config.custom=true go -t malu -t Use=true I want to get "malu" as output, and the werid thing is the blank before go is neither space nor tab. what's the sed... (4 Replies)
Discussion started by: katrvu
4 Replies
Login or Register to Ask a Question
pygn2m(1)						    Python Gateway news to mail 						 pygn2m(1)

NAME
pygn2m - Python Gateway news to mail SYNOPSIS
pygs -t recipient@domain1 -s sender@domain2 [ -e envelope@domain3 ] [ -h ] DESCRIPTION
IMPORTANT: this man page is to be continued. The Whole pyg gateway is in devel. state. try -h option for more detailed option. pygn2m reads from stdin a nntp article, sending it to recipient@domain1 a rfc822 compliant email setting Resent-Sender: sender@domain2 and envelope envelope@domain3 if exists, else sender@domain2. If pygn2m reads from stdin a sigle line starting with /, it is considered an absolute path to an article (ie in a spool), so pygn2m will open and read it. EXAMPLES
There is some documetation in /urs/share/doc/pyg I created mailgate user (moderator of local.moderated ng). Every article posted in local.moderated is sent to mailgate, in its .procmailrc I've put: :0 bhc * ^To: *local-moderated | $HOME/pygs -t kalfa@localhost -e mailgate@students.cs.unibo.it -s 'cosimo@students.cs.unibo.it' where kalfa@localhost is the recipient (usually a mailing list) Here is an header extract from kalfa@localhost mbox: From mailgate@students.cs.unibo.it From: whosentnntparticle@domain4 To: kalfa@localhost Resent-Sender: cosimo@students.cs.unibo.it note that sender and envelope are different. rfc822 says that Sender: have to be a human user (not a program or similia). envelope can mailgate user. AUTHOR
Cosimo Alfarano <alfarano@students.cs.unibo.it> BUGS
Boh. send any bug to the author, please. Sun Sep 12 22:40:00 CEST 2000 pygn2m(1)