Column manipulation of a file

In a space delimited file how would you go about removing 2 and 3 column of a file and add "word" to the first column of the file in both awk and vi?

Would this do what you want?

awk '{$2=$3=""; $0=$0; $1=$1"word"}1' file

What RudiC suggested may well do what you want, but your specification is vague. Does add "word" to the first column mean:

  1. Add "word" to the beginning of the data in the first column?
  2. Add "word" to the end of the data in the first column?
  3. Add "word" as a new field at the beginning of the line?
  4. Add "word" at a random location in the text currently in the first column?
  5. Replace the contents of the first column with "word" (which is what RudiC's code does)?
  6. Something else???

And, unless your input is a single line file, do you want these changes made to the 1st line of the file, the last line of the file, or every line in the file?

Show us sample input and corresponding desired output!

What have you tried so far (both for awk and for vi)?