0xAX
0xAX

Reputation: 21837

Add symbol to the end of each string in the file

I have txt file with plain text. There are only text strings, something like:

asdasd asd asd asd
asdasdasdasd asd a
asdasdasdasdasdasd

I need to add ; symbol to the end of every string. I need to get:

asdasd asd asd asd;
asdasdasdasd asd a;
asdasdasdasdasdasd;

How can i make this with awk or another text processing utils?

Thank you.

Upvotes: 0

Views: 1437

Answers (3)

cppcoder
cppcoder

Reputation: 23135

Open the file in vi and issue this command

:%s/$/;/g

Upvotes: 1

Tim Green
Tim Green

Reputation: 3649

sed is your friend.

sed -i "s/$/;/" filename

Upvotes: 2

Guru
Guru

Reputation: 17014

sed 's/$/;/' file

sed replace the end of the string with semi-colon.

if awk is needed (as per OP's requirement) :

awk '1' ORS=";\n" file

Upvotes: 4

Related Questions