Hope my first post is relevant enough. I'm a newbie coder and this is as much a learning exercise as it is a favor for my girlfriend. She has test results from a device that outputs data to .csv in multiple (100+) files. the important data is the separate file names and one column of data. so we want:

Input -
File1.csv
data1 data2 data3
12341 23534 3454
32453 3454 4345

File2.csv
data1 data2 data3
35123 23456 5654
34234 7578 67854

Output -
Ouputfile.csv
"File1.csv"
data2
23534
3454
"File2.csv"
data2
23456
7578

*note, sorting would be bad. we don't want to sort. order in files is important*

I have gotten a wonderful little bash script to get this to work:

#!/bin/bash

fileList=`ls inputdatafolder/`
for var in $fileList
do
	echo $var >> outputfolder/outputfile.csv
	cat testdata/$var | cut -d, -f2 >> outputfolder/outputfile.csv
done

The problem now is the workstation is (of course) Windows. So the question now is, what do I port this to so that it works on her environment?

Obvious answer is "install cygwin" but being a corporate machine that is/may not be, an option. Same goes for perl or python. Java may be possible as it is most common. I tried Batch for a short while and got no where useful even with Google's help. C++ seems like overkill but I have resources to go that route. Just no experience.

This seems like a common issue online but no one has a solid solution for such a restricted environment. A pointer in the right direction should be enough. I'll respond with my own solution(s) as I think of ideas.

Thanks
Griffman99h

Recommended Answers

All 2 Replies

Perhaps the for will work for you. That link has an example of how to split up the output of the ping command.

Ok - not used to the new editor yet. Try the for command

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.