I have a string and want to replace the / with a space.
For example having "SP/FS/RP" I want to get "SP FS RP"
However I am having problems using gsub
set phases = `echo $Aphases | awk '{gsub(///," ")}; {print}'`
I have a string and want to replace the / with a space.
For example having "SP/FS/RP" I want to get "SP FS RP"
However I am having problems using gsub
set phases = `echo $Aphases | awk '{gsub(///," ")}; {print}'`
You need to escape the slant:
gsub( /\//, " ", $0 );
tr / ' '
$
$
$ echo "SP/FS/RP" | sed 's/\// /g'
SP FS RP
$
$
$ echo "SP/FS/RP" | perl -plne 's/\// /g'
SP FS RP
$
$
tyler_durden
$ echo "SP/FS/RP"|ruby -e 'puts gets.split("/").join(" ")'
SP FS RP
Another one with awk:
awk -F/ '$1=$1'