开发者

Create new strings

I have a text files with lines like this:

boat
hou开发者_如何学运维se
car

I would like to create a new file which looks like this:

boat.mydomain.com
house.mydomain.com
car.mydomain.com

How can I do this using sed? Thanks


sed 's/.*/&.mydomain.com/' input_file >output_file

As Felix Kling pointed out, this works, too:

sed 's/$/.mydomain.com/' input_file >output_file


$ cat file
boat
house
car

$ sed -r 's/(.*)/\1.mydomain.com/' file
boat.mydomain.com
house.mydomain.com
car.mydomain.com
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜