Help in adding a string at the end of each line and append files vertically

hi,

i need a help in the script , need to append a string at the end of each line of a files , and append the files into a single file vertically.

eg

file1 has the following columns

abc,def,aaa
aaa,aa,aaa

files 2 has the following rows and columns

abc,def,aaa
aaa,aa,aaa

i want append unix at the end of each files , which will be like the following

file1 
abc,def,aaa,unix
aaa,aa,aaa,unix
file2
abc,def,aaa,unix
aaa,aa,aaa,unix

later i want to concat file1 and file2 into a single file

abc,def,aaa,unix
aaa,aa,aaa,unix
abc,def,aaa,unix
aaa,aa,aaa,unix

i want to do this in a script.. help me on this

thanks
senthil

awk -F"," '{OFS=",";$++NF="unix"}1' file1 file2

or

awk '{print $0",unix"}' file1 file2

hi Krish,

thanks for your reply , can we achive this during sed command..?

Hi,

You can use following command.

sed 's/$/,unix/' file1 file2

Thanks

YB :slight_smile: