Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is my command:

echo "Test" | sed -f <(sed -e 's/.*/s,&,gI/' mydic)  

The file mydic contains 2 columns delimited by commas (,)


The expect result is testedd, but I get AlphabetTAlphabetEAlphabetSAlphabetT.

share|improve this question
up vote 2 down vote accepted
echo Test |sed -f <(sed 's/\(.*\),\(.*\)/s,\\<\1\\>,\2,gI/' mydic)

\< and \> indicate the start and end of a word, respectively.

share|improve this answer
That works. Thank you – Runicer Apr 10 '12 at 16:36

You've asked it to replace "e" with "AlphabetE", which it's done correctly. I suspect you meant it to only consider whole words?

Try this:

echo "test" | sed -f <(sed -e 's/.*/s,\\<&\\>,gI/' mydic)

Edit: I noticed you had in fact dealt with the case issue.

share|improve this answer
Yes I meant the whole word and your command result is sed only the first alphabet. Result: AlphabetT>est – Runicer Apr 10 '12 at 16:01
Ah, I see what I did wrong. Yes, @Peter has made the right adjustment. – ams Apr 10 '12 at 19:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.