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-filehttp://stackoverflow.com/questions/9506810/add-column-to-end-of-csv-file-using-awk-in-bash-scripthttp://www.unix.com/shell-programming-scripting/213419-add-extra-column-csv-file.htmletc 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_02Assuming 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 -- For unsubscribe instructions e-mail to: users+help@global.libreoffice.org 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