LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-22-2010, 08:56 AM   #1
sushil.cool
LQ Newbie
 
Registered: Mar 2010
Posts: 15

Rep: Reputation: 0
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

Last edited by sushil.cool; 11-22-2010 at 09:10 AM. Reason: os name is now mentioned here
 
Old 11-22-2010, 09:03 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
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?
 
Old 11-22-2010, 09:25 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,328

Rep: Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471
Quote:
Originally Posted by sushil.cool View Post
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?
 
Old 11-22-2010, 09:33 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,565

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
Smells like homework to me??
 
Old 11-22-2010, 01:56 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,239

Rep: Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527
homework is my first guess
 
Old 11-22-2010, 02:25 PM   #6
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 97
.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.
 
Old 11-22-2010, 02:40 PM   #7
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy the contents of a txt file to other txt files (with similar names) by cp command TheIndependentAquarius Linux - Newbie 7 07-03-2010 01:54 AM
In Thunar, how to "Open Terminal Here" for .txt or .dat files? cstrieder Linux - Desktop 2 03-02-2009 09:02 PM
shell script to move files from one system to another sytem with file names in a txt coral_km Linux - Newbie 3 02-13-2008 11:23 PM
rename a group of files to a single extention Lleb_KCir Linux - General 9 02-20-2005 01:40 AM
I have a problem on opening VCD with *.DAT extention skasish Linux - General 7 10-31-2003 03:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration