Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-12-2012
Registered User
 
Join Date: Jul 2012
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
[Solved] Giving files .txt extension

Hi there,

I have around 145,000 files with no file extension in this directory - /home/adams/29:

The file name varies but all end with a number from 0 - 9,
e.g. TTFILE_BAT_235496, CCNHATA_RFC_23455

I want to give all these 145,000 .txt extension.

Please how do I do that?


Thanks
Sponsored Links
    #2  
Old 07-12-2012
guruprasadpr's Avatar
Shrink...ing
 
Join Date: Jun 2009
Location: India
Posts: 674
Thanks: 30
Thanked 215 Times in 214 Posts
Hi



Code:
$ ls
a1  a2  a3



Code:
$ for i in *[0-9]
> do
>  mv $i ${i}.txt
> done



Code:
$ ls
a1.txt  a2.txt  a3.txt

Sponsored Links
    #3  
Old 07-12-2012
Registered User
 
Join Date: Jul 2012
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
Thanks a lot.

You're da dude!
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to list files with no extension together with *.prog files? adshocker UNIX for Dummies Questions & Answers 4 11-24-2011 11:57 PM
[solved] merging two files and writing to another file- solved mlpathir Shell Programming and Scripting 1 10-07-2010 06:41 PM
gzip files with extension nokiak810 Shell Programming and Scripting 5 07-22-2010 10:15 PM
Files without extension rajahindustani HP-UX 1 10-09-2008 11:06 AM
Removing the extension and FTP the files pradkumar Shell Programming and Scripting 1 02-14-2007 01:01 PM



All times are GMT -4. The time now is 11:21 AM.