I have some output from iconv, e.g.$ iconv -l | grep ISO | head -5CSISO4UNITEDKINGDOM//CSISO10SWEDISH//CSISO11SWEDISHFORNAMES//CSISO14JISC6220RO//CSISO15ITALIAN//durrantm:~How can I change the //'s to, say --'s ?I tried $ (iconv -l | grep ISO).gsub('\/\/','--') but no luck.
How to grep, then search and replace on the output?
grep;replace;output
There are a few approaches using either tr, awk or sedTR: iconv -l | grep ISO |head -5 |tr '/' '-'AWK:iconv -l | awk '/ISO/{gsub(//,--); print $0}' |head -5SED:iconv -l | grep ISO |head -5 | sed 's/\//-/g'# or, to avoid needing to escape the backslashes:iconv -l | grep ISO |head -5 | sed 's#/#-#g'