On 04/11/2013 03:21 AM, Steve Edmonds wrote:

On 2013-04-11 18:17, Alex Thurgood wrote:
Le 11/04/2013 02:47, Joel Madero a écrit :

Hi Joel,

A quick trawl reveals several possibilities :

http://stackoverflow.com/questions/4749658/inserting-filename-into-last-column-of-csv-file


http://stackoverflow.com/questions/9506810/add-column-to-end-of-csv-file-using-awk-in-bash-script

http://www.unix.com/shell-programming-scripting/213419-add-extra-column-csv-file.html


etc


Alex
Hi Alex.
First example implements easily.
Converts all files with extension .csv
Not sure if the OP  wants to append 2012_01_02.csv or just 2012_01_02

Assuming the latter, the following worked for me in a bash file. Copy the files to a new directory for conversion as the files will be altered, new files are not created. These strip the .csv.

#!/bin/bash
for file in *.csv; do
    file1=${file%.*}
    sed -i "s/$/,$file1/" "$file"
done

For tab separated files
for file in *.csv; do
    file1=${file%.*}
    sed -i "s/$/\t$file1/" "$file"
done

Steve

Testing this out today Steve, thanks!

Also thanks Alex, always helpful :)

Might start a new thread about this one but, have a bit of a trickier one now. In the file there are lines that have UNCONFIRMED on a specific line (this is again, a pull list from FDO). What I would like to do is merge all the files but only keep the rows that have "UNCONFIRMED" (or anything else, that's just one stat that we're really interested in). So, the list is much too long to merge everything (3 months worth at this point), but I think if I could just get the UNCONFIRMED lines and merge into a new file completely (unconfirmed bugs January - March.csv), I could use the data to do some quick number crunching. The idea is we want to make sure that the QA team is moving forward always, it's good to set goals but we need to be able to track the goals and what not.


Best,
Joel


--
For unsubscribe instructions e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to