Article 4X44W [SOLVED] Insert word between filename.

[SOLVED] Insert word between filename.

by
ddenial
from LinuxQuestions.org on (#4X44W)
Hello

How to insert a word in between a filename with spaces while cp or mv. For example in the following two examples, I do as follows:

Code:# ls -l /etc/vsftpd/vsftpd.conf*
-rw-------. 1 root root 5113 Dec 24 18:30 /etc/vsftpd/vsftpd.conf

# cp /etc/vsftpd/vsftpd.conf{,.backup}

# ls -l /etc/vsftpd/vsftpd.conf*
-rw-------. 1 root root 5113 Dec 24 18:30 /etc/vsftpd/vsftpd.conf
-rw-------. 1 root root 5113 Dec 27 20:12 /etc/vsftpd/vsftpd.conf.backupCode:# ls -l /etc/vsftpd/vsftpd*
-rw-------. 1 root root 5113 Dec 24 18:30 /etc/vsftpd/vsftpd.conf

# cp /etc/vsftpd/vsftpd{,.PREFIX}.conf

# ls -l /etc/vsftpd/vsftpd*
-rw-------. 1 root root 5113 Dec 24 18:30 /etc/vsftpd/vsftpd.conf
-rw-------. 1 root root 5113 Dec 27 20:15 /etc/vsftpd/vsftpd.PREFIX.confFollowing this method, how to insert some chars between filename with spaces.

For example, I want to copy the file 'A Sample File.txt' as 'A Sample TEST File.txt'

I tried these, won't work.

Code:# cp 'A Sample {,TEST} File.txt'
cp: missing destination file operand after 'A Sample {,TEST} File.txt'

# cp 'A Sample \{,TEST\} File.txt'
cp: missing destination file operand after 'A Sample \{,TEST\} File.txt'Thankslatest?d=yIl2AUoC8zA latest?i=IFgz2jzkt8U:LX86u5Nkj-w:F7zBnMy latest?i=IFgz2jzkt8U:LX86u5Nkj-w:V_sGLiP latest?d=qj6IDK7rITs latest?i=IFgz2jzkt8U:LX86u5Nkj-w:gIN9vFwIFgz2jzkt8U
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments