ABOCb
ABOCb

Reputation: 5

Add a hostname to all files in folder (bash)

I'm collecting the logs from remoter servers and pleasing it in local folder. I want to add to each file I took from remote server a hostname of this server.

In DOS I can do:

ren .log HN_.log

How can I do the same in BASH?

Thanks

Upvotes: 0

Views: 127

Answers (1)

lurker
lurker

Reputation: 58244

for x in *.log; do mv $x HN_$x; done

Upvotes: 1

Related Questions