Computing.Net > Forums > Unix > renaming *.txt to *.csv

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

renaming *.txt to *.csv

Reply to Message Icon

Name: sivakarthik
Date: October 4, 2005 at 06:52:15 Pacific
OS: Unix
CPU/Ram: 512MB
Comment:

Hi,
I want to rename all .txt files to .csv files using shell script, is it possible?

Thanks
Siva

Hi,
I'm trying to replace a column in a comma seperated file with a column in another file using sed/awk. Can anyone help me.

Thanks
Siva




Sponsored Link
Ads by Google

Response Number 1
Name: sboffin
Date: October 4, 2005 at 07:00:06 Pacific
Reply:

Yes you can do that by using the FIND command

something like :
find $rootDir/log -name '*.txt' -ctime +730 -print -exec mv {} {}.txt \;

HOPE it helps


0

Response Number 2
Name: nails
Date: October 4, 2005 at 07:09:18 Pacific
Reply:

Here is one way:

#!/bin/ksh

find . -type f -name "*.txt" -print|while read obj
do
bn=$(basename $obj .txt)
mv $bn.txt $bn.csv
done



0

Response Number 3
Name: sivakarthik
Date: October 4, 2005 at 07:21:26 Pacific
Reply:

Great! it worked. Thanks Nail, Thanks Stephane.

Happy
Siva

Hi,
I'm trying to replace a column in a comma seperated file with a column in another file using sed/awk. Can anyone help me.

Thanks
Siva



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


sed substitution appendag... Return value of awk



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: renaming *.txt to *.csv

Simple, rename upper to lower www.computing.net/answers/unix/simple-rename-upper-to-lower/2676.html

Why does file has a % appended to i www.computing.net/answers/unix/why-does-file-has-a-appended-to-i/7905.html

UNIX script: *.txt->*yymmddhhmm.txt www.computing.net/answers/unix/unix-script-txtyymmddhhmmtxt/4151.html