BBEdit grep: filter out specific character from results?

194 Views Asked by At

From the following line of text:

ab•di•ca•tion

I want to produce the following line:

abdication  ab•di•ca•tion

(where the space between is a tab). This to iterate over multiple lines.

I can't find a way of 'filtering out' or excluding the • character from the results.

I'm currently using BBEdit on MacOS, but if someone can offer a Unix command line method, that would be equally acceptable.

1

There are 1 best solutions below

1
Dudi Boy On

We suggest the following sed solution:

   term="ab•di•ca•tion"; echo $(echo "$term" | sed "s|•||g") " $term";

or simpler:

   term="ab•di•ca•tion"; printf "%s %s" $(echo "$term" | sed "s|•||g") " $term";

And simpler solution with awk

    echo "ab•di•ca•tion"| awk '{a=$0;gsub("•","");print $0 " " a}'