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

help4407


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

Assignment 2 and Clarifications.
 
Options:
RSS cloud
Jump to:

Problem with Q2 in Exercise 2

2 of 390 articles shown, currently no other people reading this forum.
photo
From: Khushboo S.
Date: Thu 19th Mar, 11:43pm
Actions: 
        Login-to-reply
Hello,

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.

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

Problem with Q2 in Exercise 2

photo
From: Christopher M.
Date: Fri 20th Mar, 2:15pm
Actions: 
        Login-to-reply
"Khushboo Soni"                               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?
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  8:27am May 24 2020