Appending a new field at the end in a file

can anyone tell me please ......how to append a new field at the end of a file with the help of sed or some other command in bourne shell

What do you mean with field?
how about

echo "$field" >> "$file"

Do you mean you need an empty line at the end of the file? In this case try:

echo >> file

else please describe "new field" better.

Hi All

Am trying to insert 100 beneath 35 but the below command is not working. Can some one help me in this.

 
12 23
12
23
35
 
sed '/35/a 100' file1
 

The error is below

sed: command garbled: /35/a 100
 
Am on SUN OS

TIA

If your file looks like this:

12 23
12
23
35

A simple echo 100 >> file would do the thing, otherwise you could try this:

sed 's/35/35\
100/' file

---------- Post updated at 03:13 ---------- Previous update was at 03:10 ----------

Now I see this is not "your" thread! This is called thread/topic-hijacking and should be avoided. Why did you not open your own thread?

Actually I want to add a new column to the file.

e.g earlier there are 4 columns separated by ~
now i want to add one more column

sed 's/$/~/g' file

Let me know if that was what you were after...

Do you mean this?

$ cat x
a1~a2~a3~a4
b1~b2~b3~b4
c1~c2~c3~c4
$ cat y
a5
b5
c5
$ paste -d "~" x y
a1~a2~a3~a4~a5
b1~b2~b3~b4~b5
c1~c2~c3~c4~c5
$ 

If the file newcol contains you column:

paste -d~ infile newcol