Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How could I output the contents of a .csv file to a Zenity list. The file has multiple rows and columns and the rows are no fixed numbers. I would also like it so that when the user double clicks, on one of the entries it open a Zenity form with the text field filled in so that the csv file can be update I am using a shell bash file.

I have tried by googling but have not had much luck if you can help with just part of this then please post a answer.

share|improve this question
    
You should describe (no example) your input data more clearly. Is this full fledged csv or the csv-simple that has no newlines, separator characters or quotes in its fields? –  Anthon Feb 11 at 6:43

1 Answer 1

Input csv

$> cat data.csv

Mumbai,India
Chicago,USA
London,UK
New York,USA

Format CSV Output. Add line number split each column value with new line.

cat data.csv | \
awk -F ',' '{
    print NR; # Print Record Number 
    for(i=1;i<=NF;i++){
        print $i; # Print Each Column separeted by Default EOL
    }
}' | \
zenity --list \
--title="Title" \
--column="Index" --column="City" --column="Country" \
--print-column=2
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.