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: 21 April 2018, 8:35 AM EDT
Location: Loughborough
Posts: 1,256
Thanks: 375
Thanked 336 Times in 263 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.

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}"
AMIGA:amiga~> _

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