Hello,

I am struggling to find a solution to the following apparently simple
problem, so any help would be much appreciated.

Here is a simple example of what I'm trying to do.

>From the console of a linux machine running Fedora-12, if I do

  echo "AB" > file
  FILE=file

  sed "s/AB/12/" $FILE

I get, as expected,

  12

I can also do

  COMMAND="sed s/AB/12/ $FILE"
  $COMMAND

and again I get

  12

So far so good.  If, however, I now introduce a space with

  echo "A B" > file

I'd like to find the setting for COMMAND which is equivalent to

  sed "s/A B/1 2/" $FILE
    1 2

I've tried a number of obvious variations, but I can't get any to
work, for example,

  COMMAND="sed s/A B/1 2/ $FILE"
  $COMMAND
    sed: -e expression #1, char 3: unterminated `s' command

  COMMAND="sed \"s/A B/1 2/\" $FILE"
  $COMMAND
    sed: -e expression #1, char 1: unknown command: `"'

  COMMAND='sed "s/A B/1 2/" $FILE'
  $COMMAND
    sed: -e expression #1, char 1: unknown command: `"'

  COMMAND="sed 's/A B/1 2/' $FILE"
  $COMMAND
    sed: -e expression #1, char 1: unknown command: `''


Thanks,

Paul

-- 
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup

Reply via email to