Forums Search Login Register
Login
Username
Password
New Posts Todays Posts Find Users Posts Unanswered Threads Help Mark Forums as Read

Thread Options  Subscribe to this thread Subscribed Users  Add Reply 
Posts: 1,334
Trophies:
1
Hello ! I'm a computer science student in France and I'm learning the shell language on ubuntu. The year is already over, but I wanted to train by making a little project : an "agenda" using a csv file.

I already wrote a few functions that work pretty well, but a single problem blocks me from advancing.

First, let me explain the organization of my csv file : each line is divided like this : title,level_of_importance(integer, lower is more important),category(integer),person,date,hour,dura tion,remark .

Example of line : Mom's birthday,1,1,Mother,30/09/2020,15:30,3h,My mother is the best !

The function that doesn't work for me is the one that prints only the events of a certain category. Here is my code (translated) :

Code:
show_category()
{
echo "Please enter the number corresponding to your category :
0 : Various
1 : Birthday
2 : Scores
3 : Party "
read num_cat
IFS=,
while IFS= read -r ln 
    do
        if [ "$3" = "$num_cat" ]
        then
            printf '%s\n' "$ln"
        fi
    done
06-27-2020, 06:30 PM
Reply
Subscribe to this thread Subscribed Users  Add Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [ubuntu] script email shell bfrankgonzaluuu 0 10 10-14-2020 07:13 AM
Last Post: bfrankgonzaluuu
  [xubuntu] How to reduce distortion in wav file? jaecherio49 0 9 10-13-2020 07:40 PM
Last Post: jaecherio49
  [ubuntu] missing cups/filter file tsergiohaynesz 0 4 10-11-2020 03:00 PM
Last Post: tsergiohaynesz
  Cron Jobs / Crontab - NOT Able to Edit or Create File rstefaniacoxa 0 4 10-06-2020 01:14 PM
Last Post: rstefaniacoxa
  liblapack.so.3 cannot open shared object file meveliafritzm 0 8 09-30-2020 07:12 AM
Last Post: meveliafritzm
  Converting PCL file to PDF on Ubuntu system - ghostpcl not working - alternatives? SachaL1999 0 2 09-29-2020 04:44 PM
Last Post: SachaL1999
  Closing a folder right after opening a file CynthiaA1962 0 7 09-24-2020 09:37 AM
Last Post: CynthiaA1962
  [ubuntu] pdftk "Error: Unable to find file." on ubuntu 20.04 wsusannahmccyyy 0 22 09-04-2020 06:44 PM
Last Post: wsusannahmccyyy
  Correct way to edit file Gerhard1 0 16 08-27-2020 06:20 AM
Last Post: Gerhard1
  LUBUNTU Pcmanfm how look exactly how Windows File Explorer ? Ice Queen 0 24 07-20-2020 05:44 AM
Last Post: Ice Queen

Forum Jump:



User(s) browsing this thread: 1 Guest(s)



Contact Us Privacy Policy Top RSS
Forum Software By: MyBB, © 2002-2020