Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

How to rename all files at a time by appending some characters at the begining?

$
0
0
Hi

I have a list a filename in a directory starting with particular pattern
for example:
abc_1234.txt
abc_7565.txt
abc_7676.txt
abc_7765.txt


i need to rename all these files by appending bck. or bck_

Expected output:
bck.abc_1234.txt
bck.abc_7565.txt
bck.abc_7676.txt
bck.abc_7765.txt


Can anyone suggest something regarding this.
I tried the below code but its not actually working. How to make this permanent.

Code:

ls -1 abc* | awk '{$1="bck."$1; print $1}'
but not getting the expected result.

I am using k-shell

Viewing all articles
Browse latest Browse all 16232

Trending Articles