LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to move 10 files of .dat extention to .txt using single command or script (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-move-10-files-of-dat-extention-to-txt-using-single-command-or-script-845795/)

sushil.cool 11-22-2010 07:56 AM

how to move 10 files of .dat extention to .txt using single command or script
 
hi
I have 10 files of .dat format
say
A MCDR .dat
B MCDR .dat
and so one upto 10 dat file
how i convert these 10 dat files to txt files using single command or script

its for unix aix

colucix 11-22-2010 08:03 AM

You can try the rename command:
Code:

rename .dat .txt *.dat
Please note that there are two different versions of the rename command, one of them being a Perl script. Depending on which version you have, the syntax can be different. Check the rename man page on your system and look at the output of
Code:

file `which rename`
to see wich version you have. Post the output here, if in doubt. Which Linux OS are you running on, anyway?

TB0ne 11-22-2010 08:25 AM

Quote:

Originally Posted by sushil.cool (Post 4167046)
hi
I have 10 files of .dat format
say
A MCDR .dat
B MCDR .dat
and so one upto 10 dat file
how i convert these 10 dat files to txt files using single command or script

its for unix aix

You do realize that you could have renamed all 10 files in less time than it took you to post this, right?

Why do you have to rename them all in one single command, anyway? What are you trying to accomplish?

grail 11-22-2010 08:33 AM

Smells like homework to me??

John VV 11-22-2010 12:56 PM

homework is my first guess

Disillusionist 11-22-2010 01:25 PM

.dat implies data and the initial post mentions that these should be converted to text files.

This would very much depend on the format of the data in the original files.

simply renaming the file from .dat to .txt will not achieve very much.

honeybadger 11-22-2010 01:40 PM

Renaming dat files to txt is going to cause more issues than what you are ready to handle. Keep a backup of the dat files. If this is homework, dude, you are messed up. Study a bit harder look at man cp man mv man ln and see if you are enlightened.


All times are GMT -5. The time now is 07:44 AM.