Sponsored Content
Top Forums Shell Programming and Scripting Save output of updated csv file as csv file itself Post 302939830 by refrain on Monday 30th of March 2015 01:26:13 AM
Old 03-30-2015
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
Code:
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
/home/intannf/foto/IMG_0759.JPG,2015:02:17 11:49:09
/home/intannf/foto/IMG_0771.JPG,2015:02:17 11:51:22
/home/intannf/foto/IMG_0745.JPG,2015:02:17 11:36:01
/home/intannf/foto/IMG_0763.JPG,2015:02:17 11:49:45
/home/intannf/foto/IMG_0666 (1).JPG,2015:02:17 09:59:48
/home/intannf/foto/IMG_0782.JPG,2015:02:17 11:54:16
/home/intannf/foto/IMG_0750.JPG,2015:02:17 11:37:29
/home/intannf/foto/IMG_0762.JPG,2015:02:17 11:49:24
/home/intannf/foto/IMG_0752.JPG,2015:02:17 11:37:40
/home/intannf/foto/IMG_0684.JPG,2015:02:17 10:54:51
/home/intannf/foto/IMG_0687.JPG,2015:02:17 10:56:43
/home/intannf/foto/IMG_0777.JPG,2015:02:17 11:53:43
/home/intannf/foto/IMG_0756.JPG,2015:02:17 11:45:21
/home/intannf/foto/IMG_0746.JPG,2015:02:17 11:37:18
/home/intannf/foto/IMG_0743.JPG,2015:02:17 11:34:26

Output required
Code:
SourceFile,DateTimeOriginal
/home/intannf/foto/IMG_0666 (1).JPG,2015:02:17 09:59:48
/home/intannf/foto/IMG_0684.JPG,2015:02:17 10:54:51
/home/intannf/foto/IMG_0687.JPG,2015:02:17 10:56:43
/home/intannf/foto/IMG_0739.JPG,2015:02:17 11:32:21
/home/intannf/foto/IMG_0743.JPG,2015:02:17 11:34:26
/home/intannf/foto/IMG_0745.JPG,2015:02:17 11:36:01
/home/intannf/foto/IMG_0746.JPG,2015:02:17 11:37:18
/home/intannf/foto/IMG_0749.JPG,2015:02:17 11:37:28
/home/intannf/foto/IMG_0750.JPG,2015:02:17 11:37:29
/home/intannf/foto/IMG_0752.JPG,2015:02:17 11:37:40
/home/intannf/foto/IMG_0756.JPG,2015:02:17 11:45:21
/home/intannf/foto/IMG_0759.JPG,2015:02:17 11:49:09
/home/intannf/foto/IMG_0762.JPG,2015:02:17 11:49:24
/home/intannf/foto/IMG_0763.JPG,2015:02:17 11:49:45
/home/intannf/foto/IMG_0771.JPG,2015:02:17 11:51:22
/home/intannf/foto/IMG_0777.JPG,2015:02:17 11:53:43
/home/intannf/foto/IMG_0782.JPG,2015:02:17 11:54:16

and this is my script:
Code:
sort --field-separator=',' --key=2 -n test.csv > test.csv

Unfortunately, when i checked them out, there is no data in the test.csv. It is blank. Or it should be saved as another csv file? But i need to save it as csv file itself.

Please help me how to solve it. Thanks in advance.

Regards,
Intan
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

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 ... (1 Reply)
Discussion started by: rohitkalia
1 Replies

2. 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

3. 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

4. Shell Programming and Scripting

need to save the space when converting to CSV file

Hi, I have a text file with the following format. Some of the fields are blank. 1234 3456 23 45464 327837283232 343434 5654353 34 34343 3434345 434242 .... .... .... I need to convert this file to a CSV file, like 1234, ,23, ... (3 Replies)
Discussion started by: wintersnow2011
3 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

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

7. Shell Programming and Scripting

Match columns from two csv files and update field in one of the csv file

Hi, I have a file of csv data, which looks like this: file1: 1AA,LGV_PONCEY_LES_ATHEE,1,\N,1,00020460E1,0,\N,\N,\N,\N,2,00.22335321,0.00466628 2BB,LES_POUGES_ASF,\N,200,200,00006298G1,0,\N,\N,\N,\N,1,00.30887539,0.00050312... (10 Replies)
Discussion started by: djoseph
10 Replies

8. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

9. 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
pilot-foto(1)							    PILOT-LINK							     pilot-foto(1)

NAME
pilot-foto - Palm 'Foto' Image Installer/Remover/Fetcher/Converter SECTION
pilot-link: Userland conduits SYNOPSIS
pilot-foto [-p|--port <port>] [--version] [-?|--help] [-q|--quiet] [--usage] [-d|--delete] [--delete-all] [-i|--install] [-l|--list] [-f|--fetch] [-F|--fetch-all] [-c|--convert] DESCRIPTION
This is a palm conduit to fetch, install, or remove, Foto files from a Palm. It can also convert *.jpg.pdb files that have already been fetched from the Palm to jpeg files. Delete all, or named fotos from handheld. Install one, or many jpeg images to handheld. List all jpeg files and thumbnails on handheld. Fetch all jpeg files, or certain ones by name. Tries to detect if a file really is a jpeg and refuses to install it, if it is not. pilot-foto allows you to do multiple operations in one sync. For instance, delete test.jpg and install test.jpg. USAGE
pilot-foto -p <port> [options] file OPTIONS
pilot-foto options -d, --delete Delete a jpg file on the handheld --delete-all Delete ALL jpg files on the handheld -i, --install Install a jpg file -l, --list List all photos and thumbnails -f, --fetch Fetch files from the Palm -F, --fetch-all Fetch ALL jpg files from the Palm -c, --convert convert [file].jpg.pdb files to jpg Conduit Options -p, --port port Use device file port to communicate with the Palm handheld. If this is not specified, pilot-foto will look for the $PILOTPORT environment variable. If neither are found or supplied, pilot-foto will print the usage information. -q, --quiet Suppress 'Hit HotSync button' message -v, --version Display version of pilot-foto and exit without connecting. Help Options -h, --help Display the help synopsis for pilot-foto and exit without connecting. --usage Display a brief usage message and exit without connecting. EXAMPLES
Examples: pilot-foto -p /dev/pilot -f pilot-foto -d MyImage.jpg pilot-foto -i MyImage.jpg pilot-foto -i *.jpg pilot-foto -f MyImage pilot-foto -c MyImage.jpg.pdb PROBLEMS
Palm has not published their database format for the thumbnails. So, pilot-foto puts a generic penguin thumbnail for every image uploaded. Fotos can be accessed by a named list on the handheld as well as the thumbnails. This has been tried on a couple of handhelds. It is possi- ble that a foreign palm or different model will not like it. To get a thumbnail image you can copy the jpegs to the memory card. If you copy them back to the handheld they will have a new thumbnail that matches the jpeg. AUTHOR
This manual page was converted to XML by Neil Williams <linux@codehelp.co.uk> BUGS
If a jpeg is installed with the same name as one already on the palm you will have 2 thumbnails pointing to the same jpeg. The new jpeg will overwrite the old jpeg. If the thumbnail fails to install then the jpeg should be removed. It is not. We have an online bug tracker. Using this is the only way to ensure that your bugs are recorded and that we can track them until they are resolved or closed. Reporting bugs via email, while easy, is not very useful in terms of accountability. Please point your browser to http://bugs.pilot-link.org: http://bugs.pilot-link.org and report your bugs and issues there. COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. SEE ALSO
pilot-link(7) 0.12.5 Copyright 1996-2007 FSF pilot-foto(1)
All times are GMT -4. The time now is 06:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy