Data fetched from text file and save in a csv file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Data fetched from text file and save in a csv file
# 1  
Old 04-27-2009
Bug Data fetched from text file and save in a csv file

Hi i have wriiten a script which fetches the data from text file, and saves in the output in a text file itself, but i want that the output should save in different columns.
I have the output like:
For Channel:response_time__24.txt

1547 data points
0.339
0.299
0.448
0.581
7.380
0.372

For Channel:response_time__48.txt

2878 data points
0.350
0.305
0.446
0.566
9.070
0.441


I want that for 48 channels it should come in a different column, cureently i am saving it in a text file itself.

Script i have wriiten is:
for i in `ls *.txt`
do
echo $i;
echo -e "
" >> 4;
echo "For Channel:`ls $i`" >>4;
`tail -37 "$i" >2`;
`grep -v -E 'Calculating|Remaining' 2 >3`;
echo -e "
" >> 4;
`cut -f2 -d":" <3 >>4`;
\rm 2 3;
done;

Please help me, how do i save the output like
For Channel:response_time__24.txt For Channel:response_time__48.txt
1547 data points 2878 data points
0.339 0.350
0.299 0.305
0.448 0.446
0.581 0.566
7.380 9.070
0.372 0.441


Thanks
Rohit
# 2  
Old 06-10-2009
If this is a routine task then perhaps you are helped with reading both files into a database (sqlite is standard installed on a lot of systems) and export the result: set an autonumber as the first column for both tables and then write a query by matching on the autonumber; the result can be exported to a csv file.

Hope this helps
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

2. Shell Programming and Scripting

Save output of updated csv file as csv file itself, part 2

Hi, I have another problem. I want to sort another csv file by the first field. result.csv SourceFile,Airspeed,GPSLatitude,GPSLongitude,Temperature,Pressure,Altitude,Roll,Pitch,Yaw /home/intannf/foto5/2015_0313_090651_219.JPG,0.,-7.77223,110.37310,30.75,996.46,148.75,180.94,182.00,63.92 ... (2 Replies)
Discussion started by: refrain
2 Replies

3. Shell Programming and Scripting

Save output of updated csv file as csv file itself

Hi, all I want to sort a csv file based on timestamp from oldest to newest and save the output as csv file itself. Here is an example of my csv file. test.csv SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0739.JPG,2015:02:17 11:32:21 /home/intannf/foto/IMG_0749.JPG,2015:02:17 11:37:28... (10 Replies)
Discussion started by: refrain
10 Replies

4. Shell Programming and Scripting

Converting data for text file to csv

Gents Using the script attached (raw2csv). i use to create the file .csv.. The input file is called 201.raw. Kindly can you check if there is easy way to do it. The script works fine but takes a lot time to process Thanks for your help (8 Replies)
Discussion started by: jiam912
8 Replies

5. Shell Programming and Scripting

FILE_ID extraction from file name and save it in CSV file after looping through each folders

FILE_ID extraction from file name and save it in CSV file after looping through each folders My files are located in UNIX Server, i want to extract file_id and file_name from each file .and save it in a CSV file. How do I do that? I have folders in unix environment, directory structure is... (15 Replies)
Discussion started by: princetd001
15 Replies

6. Shell Programming and Scripting

Open Text file input data and save it.

Hi Guys, I have blank file A.txt I will run the script xyz.sh First i want to open a.txt file... Now i will enter some data like XYZ ABC PQR .. Save it and keep continue my script.... END of my script. Thanks (1 Reply)
Discussion started by: asavaliya
1 Replies

7. UNIX for Dummies Questions & Answers

CSV file:Find duplicates, save original and duplicate records in a new file

Hi Unix gurus, Maybe it is too much to ask for but please take a moment and help me out. A very humble request to you gurus. I'm new to Unix and I have started learning Unix. I have this project which is way to advanced for me. File format: CSV file File has four columns with no header... (8 Replies)
Discussion started by: arvindosu
8 Replies

8. Shell Programming and Scripting

select data from oracle table and save the output as csv file

Hi I need to execute a select statement in a solaris environment with oracle database. The select statement returns number of rows of data. I need the data to be inserted into a CSV file with proper format. For that we normally use "You have to select all your columns as one big string,... (2 Replies)
Discussion started by: rdhanek
2 Replies

9. Shell Programming and Scripting

Exporting text file data to csv

Could any one help me in basic shell script to export text file data to csv. I need to export only particular data from text file to csv column. I am a newbie to UNIX could anyone help me with sample script code (3 Replies)
Discussion started by: l_jayakumar
3 Replies
Login or Register to Ask a Question