Delete to eol after pattern with sed | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Delete to eol after pattern with sed

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-19-2012
ppaprota ppaprota is offline
Registered User
 
Join Date: Nov 2012
Last Activity: 19 November 2012, 4:01 PM EST
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Delete to eol after pattern with sed

working on interactive ftp script
saving log and want to remove the password from log
so
Code:
 "quote PASS foofoo"

would become
Code:
"quote PASS XXXXXXX"

replacing or removing the password is of no matter

have tried several sed commands but have only been successful with character matching not pattern

thanks
pp

Last edited by jim mcnamara; 11-19-2012 at 06:28 PM..
Sponsored Links
    #2  
Old 11-19-2012
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Advisor  
Forum Advisor
 
Join Date: Feb 2005
Last Activity: 30 July 2014, 3:10 PM EDT
Location: Foxborough, MA
Posts: 7,644
Thanks: 150
Thanked 577 Times in 542 Posts
what exactly have you tried and failed?
Sponsored Links
    #3  
Old 11-19-2012
ppaprota ppaprota is offline
Registered User
 
Join Date: Nov 2012
Last Activity: 19 November 2012, 4:01 PM EST
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
various attempts now trying to work with

Code:
sed s/PASS[^PASS]*$//

as a starting point
it will do in a pinch but really what i want

never mind

Code:
sed s/[^PASS]*$//

works

needed to get my thoughts right

thanks

---------- Post updated at 04:01 PM ---------- Previous update was at 01:48 PM ----------

correction

Code:
sed s/PASS.*$/'PASS XXXXXXX'/

apologies
example follows:

[ppaprota@pettallc ~]$
Code:
echo "quote PASS hidemypass" | sed s/'quote PASS.*$'/'quote PASS XXXXXXX'/

quote PASS XXXXXXX
[ppaprota@pettallc ~]$

Last edited by jim mcnamara; 11-19-2012 at 06:28 PM..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Delete to eol after PASS with sed ppaprota How to Post in the The UNIX and Linux Forums 1 11-19-2012 01:29 PM
Including EOL in egrep pattern for multiple lines Anonym Shell Programming and Scripting 2 11-09-2012 10:45 AM
sed pattern to delete lines containing a pattern, except the first occurance gary_w Shell Programming and Scripting 8 10-09-2011 06:47 PM
locate a pattern and delete it using sed hobiwhenuknowme UNIX for Dummies Questions & Answers 2 08-10-2010 09:32 PM
sed delete pattern with special characters stinkefisch Shell Programming and Scripting 5 09-13-2009 10:58 PM



All times are GMT -4. The time now is 01:45 AM.