Unix/Linux Go Back    



How to replace special characters?

UNIX for Advanced & Expert Users




Kindly Note - This is a Single User Post by Forum Member wisecracker Regarding:
How to replace special characters?.
Please Follow The Primary Link Above to View the Full Discussion.

   
Old Unix and Linux 04-21-2017   -   Original Discussion by Ravi.K
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 13 November 2017, 2:52 PM EST
Location: Loughborough
Posts: 1,224
Thanks: 367
Thanked 323 Times in 253 Posts
Why use sed?
Longhand using OSX 10.12.4, default bash terminal.
(Assumption bash is available.)
Interactive mode is a great way to test.

Code:
Last login: Fri Apr 21 22:35:25 on ttys000
AMIGA:amiga~> STRING='|*|.5|*|0.2|*|A.B|*|'
AMIGA:amiga~> PREFIX="|*|0"
AMIGA:amiga~> echo "$PREFIX${STRING:3}"
|*|0.5|*|0.2|*|A.B|*|
AMIGA:amiga~> _

The Following User Says Thank You to wisecracker For This Useful Post:
jim mcnamara (04-21-2017)