01-29-2011
CSV file
I am new to script writing. With the help of others I now have a script that reads the files names in a folder and records each file name in a comma delimited file. "import.txt".
I can now import this into Open office Calc as a TextCSV file but it places each file name at the head of a separate column.
What I really want is to be able to import the file such that it shows each file name in a separate row but in the 1 column.
It seems to me I need some how to put a return. line feed or carriage return in where the , is in the script.
How do I do this?
I known one can do an Edit cut and the a special paste in a way that transposes the data base from a single long row of data and to a single column but this is messy for the numbers I have to do. So if it can be done in the generation of the CSV file it would be a lot beter and easier.
I am using OpenOffice 3.3, and Fedora 14 64 bit as the OS
The current script in the area where the comma is is
"$LINE," >> import.txt: done.
This works fine for what I want but it gives the end results as I say with the file name one per column when importing as comma delimited.
Thanks
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
Am new to scripting. So i just need your ideas to help me out. Here goes my requirement.
I have two csv files
1.csv 2.csv
abc,1.24 abc,1
def,2.13 def,1
I need to compare the first column of 1.csv with 2.csv and if matches then need to compare... (2 Replies)
Discussion started by: chinnahyd
2 Replies
2. Shell Programming and Scripting
I have been trying to find a good solution for this seemingly simple task for 2 days, and I'm giving up and posting a thread. I hope someone can help me out!
I'm on HPUX, using sqlplus, mailx, awk, have some other tools available, but can't install stuff that isn't already in place (without a... (6 Replies)
Discussion started by: soldstatic
6 Replies
3. Shell Programming and Scripting
Hi,
I am tryng to read from a csv file and based on some grep command output I will modify one of the column in the same csv.
Example:-
Input CSV:-
20120829001415,noneAA,google.com
20120829001415,dfsafds,google.com
20120829001415,noneAA,google.com
Intermediate Step:- If 2nd column of... (3 Replies)
Discussion started by: kmajumder
3 Replies
4. Shell Programming and Scripting
(say) I have 2 csv files - file1.csv & file2.csv as mentioned below:
file1.csv
ID,version,cost
1000,1,30
2000,2,40
3000,3,50
4000,4,60
file2.csv
ID,version,cost
1000,1,30
2000,2,45
3000,4,55
6000,5,70
... (1 Reply)
Discussion started by: Naresh101
1 Replies
5. Shell Programming and Scripting
(say) I have 2 csv files - file1.csv & file2.csv as mentioned below:
file1.csv
ID,version,cost
1000,1,30
2000,2,40
3000,3,50
4000,4,60
file2.csv
ID,version,cost
1000,1,30
2000,2,45
3000,4,55
6000,5,70
The... (7 Replies)
Discussion started by: Naresh101
7 Replies
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
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
LEARN ABOUT DEBIAN
test::assertions::testscript
Test::Assertions::TestScript(3pm) User Contributed Perl Documentation Test::Assertions::TestScript(3pm)
NAME
Test::Assertions::TestScript - Base for test scripts
SYNOPSIS
use Test::Assertions::TestScript;
use Module::To::Test qw( frobnicate );
ASSERT(frobnicate(),"Frobnicate returns true");
DESCRIPTION
Test::Assertions::TestScript provides a base for writing test scripts. It performs some common actions such as setting up the @INC path and
parsing command-line options, specifically:
o The lib and t/lib directories are added to @INC.
o The current directory is changed to the directory the script is in.
o Test script command-line options are parsed. (See "COMMAND-LINE OPTIONS")
o The test set of functions from Test::Assertions are imported into your test script.
Test::Assertions::TestScript makes certain assumptions about the filesystem layout of your project:
o Modules that you are testing are in the lib directory of your project.
o Test scripts are in the t directory.
o There may also be a t/lib directory for any modules written for the test process.
Test::Assertions::TestScript should be "use"d before any modules that you intend to test.
OPTIONS
Options can be supplied to the import function. These should be placed after the "use" or "import". For example
use Test::Assertions::TestScript( tests => 10, options => { 'b', $opt_b })
The following options are defined:
tests
The number of tests to pass to "plan tests" from Test::Assertions. For example to tell Test::Assertions::TestScript that the script
contains 42 tests:
use Test::Assertions::TestScript tests => 42;
options
A hashref of additional options to capture via Getopt::Long. The "options" import parameter is passed verbatim to GetOptions, so
something along the following lines is required in order to capture the "-b" command line option:
use Test::Assertions::TestScript( options => { 'b' => $opt_b } );
COMMAND-LINE OPTIONS
A script based on Test::Assertions::TestScript will detect the following command line options.
-t Shallow tracing. Traces are "print"ed and AutoImport is turned on.
-T Deep tracing. Traces are "print"ed and AutoImport is turned on.
--trace-module=MODULE
Imports tracing into MODULE specifically. Can be specified multiple times.
-s Save generated output. You will need to write the actual code to do this in your testscript, but you can inspect
$Test::Assertions::TestScript::SAVE_OUTPUT to see whether this argument was given.
Be aware that all other command line options will be disregarded unless the "options" import parameter is used to capture them.
VERSION
$Revision: 1.18 $
AUTHOR
Colin Robertson <cpan _at_ bbc _dot_ co _dot_ uk>
COPYRIGHT
(c) BBC 2005-6. This program is free software; you can redistribute it and/or modify it under the GNU GPL.
See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt
perl v5.10.0 2006-08-10 Test::Assertions::TestScript(3pm)