There is also the rename command in at list some Linux distributions.
One way is to use:
rename 's/\.csv/\.txt/' *.csv
Tim McMahon
Technical Services Manager
West Liberty Public Library
319-627-2084
________________________________
From: Code for Libraries <[log in to unmask]> on behalf of Joseph Andrew Koivisto <[log in to unmask]>
Sent: Wednesday, April 8, 2020 8:59 AM
To: [log in to unmask] <[log in to unmask]>
Subject: Re: [CODE4LIB] CSV to TXT Online converter
This might help. Pretty clear explication of what is going on here:
https://unix.stackexchange.com/questions/181141/rename-multiple-files-with-mv-to-change-the-extension
On Wed, Apr 8, 2020 at 9:57 AM Andreas Orphanides <[log in to unmask]> wrote:
> I don't think that *NIX commands are really set up to expect batch inputs
> for the most part, which is why the Stack Overflow script requires the use
> of "for" and "sed". I'll let an expert correct/clarify for me....
>
> On Wed, Apr 8, 2020 at 9:51 AM Parthasarathi Mukhopadhyay <
> [log in to unmask]> wrote:
>
> > Thanks Andreas Orphanide
> >
> > It was a mere issue with file extension (.txt). Now the downstream
> program
> > is behaving perfectly well.
> > I performed with small set of 100 files and it worked well. I have gone
> > through the stackoverflow post but wondering why
> >
> > mv *.csv *.txt is not working (I tried but failed).
> >
> > Thanks and regards
> >
> >
> >
> >
> > -----------------------------------------------------------------------
> > Dr. Parthasarathi Mukhopadhyay
> > Professor, Department of Library and Information Science,
> > University of Kalyani, Kalyani - 741 235 (WB), India
> > -----------------------------------------------------------------------
> >
> >
> > On Wed, Apr 8, 2020 at 5:11 PM Andreas Orphanides <[log in to unmask]>
> > wrote:
> >
> > > Unless there's something I am not understanding about this problem,
> > > converting CSV to TXT should just be a matter of changing the file
> > > extension from ".csv" to ".txt", and even this isn't strictly speaking
> a
> > > requirement. CSV is just a text file with a specific layout to the text
> > to
> > > define columns -- try to open a .csv file using your favorite text
> editor
> > > and you should not have any issues whatsoever (unless there's a
> character
> > > encoding issue, but then you'd see the problem whether the file was CSV
> > or
> > > TXT).
> > >
> > > If the file name is important for some other part of the workflow (a
> > > downstream program that would refuse the file unless it's .txt),
> here's a
> > > Stack Overflow post
> > > <
> > >
> >
> https://stackoverflow.com/questions/9590935/change-extension-of-file-using-shell-script
> > > >
> > > with a *NIX script command to change the file extension. Similar
> methods
> > > exist in Windows
> > > <
> > >
> >
> https://www.addictivetips.com/windows-tips/batch-change-rename-file-extensions-in-windows/
> > > >
> > > .
> > >
> > > If there's something else about the underlying problem, please do
> share!
> > >
> > >
> > > On Wed, Apr 8, 2020 at 7:30 AM Parthasarathi Mukhopadhyay <
> > > [log in to unmask]> wrote:
> > >
> > > > Could you plz guide me in finding an ONLINE tool for the following
> > > > workflow?
> > > >
> > > > 1. A large csv file with 40K+ rows split into number of csv files
> (one
> > > file
> > > > per row).
> > > > This step is done.
> > > >
> > > > 2. These large number of csv files need to be converted into text
> files
> > > > before further processing and I wish to do it in the following way:
> > > > 2.1 make zip file for all csv files
> > > > 2.2 upload csv.zip file (as a single file) to online converter
> > > > 2.3 convert all csv files (in the single zip file) into txt files
> > > > (UTF-8 encoding is preferred but not necessary at this stage)
> > > > 2.4 download the converted text files preferably as a zip file.
> > > >
> > > > I was/am searching such a tool/converter for last seven days but
> what I
> > > > found are tools like docspal.com which can take only csv files as
> > input
> > > > and
> > > > that 5 at a time at the best.
> > > >
> > > > Waiting eagerly for guidance. If no such online tool available, you
> may
> > > > please direct me to available scripts/software in solving the issue
> at
> > > > hand.
> > > >
> > > > Thanks and regards
> > > >
> -----------------------------------------------------------------------
> > > > Parthasarathi Mukhopadhyay
> > > > Professor, Department of Library and Information Science,
> > > > University of Kalyani, Kalyani - 741 235 (WB), India
> > > >
> -----------------------------------------------------------------------
> > > >
> > >
> >
>
--
*Joseph A. Koivisto*
*Systems Librarian*
*Consortial Library Applications Support*
*University of Maryland*
*McKeldin Library, Room B0238*
*7649 Library Ln., College Park, MD 20742-7011*
*[log in to unmask] <[log in to unmask]>*
*301-314-4812**[image: ORCID iD icon]orcid.org/0000-0002-7515-2522*
<https://orcid.org/0000-0002-7515-2522>
|