It's UWAweek 48

help2003/help4407

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

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying the 3 articles in this topic
Showing 3 of 564 articles.
Currently 7 other people reading this forum.


 UWA week 23 (1st semester, 1st exam week) ↓
SVG not supported

Login to reply

👍?
helpful
2:09pm Tue 7th Jun, ANONYMOUS

/,.*[a-zA-Z].*/d. Hi guys, I am having trouble understanding this piece of code using sed on the lines down below. Universal uNIVErsity,one,two,three Queensland uNIversity of Technology,38423,7157,45580,x Flinders University,18995,3812,22807,hi Blunderville University,1,2n,4 Unlimited University,nine,ten,nineteen Edith Cowan University,22202,4239,26441 After its run, it leaves: Edith Cowan University,22202,4239,26441 I don't understand how it works cause the program specifies after every comma, delete any number of charcaters so shouldn't every line be gone and whats the point of the [a-zA-Z] if every lines is going to be gone anyway. And I think its only looking for the characters at the end of every line but shouldn't that be specified by the $sign. Thanks for your help.


SVG not supported

Login to reply

👍x1
helpful
2:57pm Tue 7th Jun, ANONYMOUS

/,.*[a-zA-Z].*/d -- It means that lines which have at least 1 letter (a-z or A-Z) after a comma should be deleted. The only line which doesn't have a letter after comma is [Edith Cowan University,22202,4239,26441]. It only has numbers after any comma. So, only this remains and rest all are deleted. For instance the line [Queensland uNIversity of Technology,38423,7157,45580,x] has x at the end. Similarly, the line [> Blunderville University,1,2n,4] has n.


SVG not supported

Login to reply

👍?
helpful
3:56pm Tue 7th Jun, Michael W.

Hi, The first person who responded is entirely on the money in terms of saying what the code you presented actually does. What I think you may be confusing this is is the substitute command s/,.*[a-zA-Z].*// which removes everything from the comma so long as there is at least one letter. So, applied to: Blunderville University,1,2n,4 you end up with Blunderville University Cheers MichaelW PS GOOD LUCK.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy