开发者

Create new strings

开发者 https://www.devze.com 2023-02-02 03:20 出处:网络
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:

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

精彩评论

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