Appending file content

how to append the contents of filel to the contents of file2?.

i.e.

file1:
1
2
3

file2:
4
5
6

then the file2 shoud be
4
5
6
1
2
3

how can i achieve this..?

cat file1 >> file2

You are almost right

but as i tried it should be:
cat file2 >> file1

thanks

This will generate the following output

1
2
3
4
5
6

which is not the one u have mentioned in your first post.

The file1 >> file2 is generating
1
2
3
4
5
6

and file2 >> file is generating
4
5
6
1
2
3

which i asked in question.
The content of file2 should be appended with the content of file1
I think you are little confused.
But thanks, coz you solved my one assignment question.

Please see your first post carefully.

cat file1 >> file2 means
4
5
6
1
2
3

and cat file2 >> file1 means
1
2
3
4
5
6

if
file1:
1
2
3

file2:
4
5
6

then
cat file1 >> file2 is generating
1
2
3
4
5
6

and cat file2 >> file1 is generating
4
5
6
1
2
3

do u hv any doubt with these results..?

Have you tried to execute it shashwat? Or perhaps you have file1 and file2 reversed. Like R0h0n says, it really is the other way around..

$ cat file1
1
2
3
$ cat file2
4
5
6
$ cat file1 >> file2
$ cat file2
4
5
6
1
2
3
1 Like