Faculty of Engineering and Mathematical Sciences 
Not logged in (login)


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting (CITS4407).
RSS cloud
Jump to:

Problem with Q2 in Exercise 2

1 of 390 articles shown, currently no other people reading this forum.
From: Christopher M.
Date: Fri 20th Mar 2020, 2:15pm


"Khushboo Soni" <22*3*7*[email protected]*u*e*t*u*a*e*u*a*> wrote:

> I think I have a slight error in my code. I'm trying to sort the second column after 
> selecting the required Fuel station and type of Fuel. But it isn't working. Not sure 
> what am I missing as I did the same thing in lab computer and it worked.

Hi Khushboo,

When describing (future) questions, it'd be great if you can describe your error in a bit of 
detail.  All we have is "But it isn't working", and knowing what you're seeing or not seeing 
would help.

> cut -d, -f1,2,4,5 FuelWatchRetail-02-2020.csv| grep "Caltex StarMart Applecross"| 
> grep "PULP"|cut -d, -f1,4|sort -t -k2

I think the problem is with your invocation of sort.
When using cut, we must indicate the character used to delimit fields. We cut cut -d, .....

The same is true with sort, though it requires the -t switch, as in:

   .... | sort -t, -k

Does that fix it?

Related articles

Problem with Q2 in Exercise 2 (both) RSS
├─ original   Thu 19th Mar 2020, 11:43pm, Khushboo S.
└─ THIS   Fri 20th Mar 2020, 2:15pm, Christopher M.
This Page

Program written by: [email protected]
Feedback welcome
Last modified: 11:27am Sep 21 2020