F5F Stay Refreshed Software Operating Systems Linux CLI "grep" command

Linux CLI "grep" command

Linux CLI "grep" command

Pages (2): Previous 1 2
X
xXRAXERXx
Posting Freak
817
04-30-2023, 10:17 AM
#11
I noticed a positive response! It would have been helpful to understand the final outcome you were aiming for, rather than relying on guesswork.
X
xXRAXERXx
04-30-2023, 10:17 AM #11

I noticed a positive response! It would have been helpful to understand the final outcome you were aiming for, rather than relying on guesswork.

S
Skysel
Member
71
05-02-2023, 06:32 AM
#12
They picked an inappropriate case for practice! While it's helpful to understand input/output control through pipes, using "ls | grep something" isn't the best illustration since it doesn't clearly show pipe utility. A simpler approach would be shell expansion like "ls -l /etc/*[gG]*", which is more intuitive and effective. The exercise also relies on assumptions such as certain files always containing specific characters or formats, which can mislead learners. It's better to provide straightforward examples where users can manipulate data directly, avoiding overly complex scenarios. If output consistency is crucial, consider generating structured lists or using predefined templates so results remain uniform across sessions.
S
Skysel
05-02-2023, 06:32 AM #12

They picked an inappropriate case for practice! While it's helpful to understand input/output control through pipes, using "ls | grep something" isn't the best illustration since it doesn't clearly show pipe utility. A simpler approach would be shell expansion like "ls -l /etc/*[gG]*", which is more intuitive and effective. The exercise also relies on assumptions such as certain files always containing specific characters or formats, which can mislead learners. It's better to provide straightforward examples where users can manipulate data directly, avoiding overly complex scenarios. If output consistency is crucial, consider generating structured lists or using predefined templates so results remain uniform across sessions.

C
chenglee1998
Member
147
05-02-2023, 01:52 PM
#13
Grep performs more than just matching wildcards. In your scenario, if you wish to exclude results containing 'g' in the output, a more complex regex pattern is necessary rather than simply using 'g'. You might want to target only matches with 'g' in filenames or directories that don’t include 'Aug', but this can be tricky. Consider using a version of ls that displays just directory and file names without extras, then apply grep commands afterward.
C
chenglee1998
05-02-2023, 01:52 PM #13

Grep performs more than just matching wildcards. In your scenario, if you wish to exclude results containing 'g' in the output, a more complex regex pattern is necessary rather than simply using 'g'. You might want to target only matches with 'g' in filenames or directories that don’t include 'Aug', but this can be tricky. Consider using a version of ls that displays just directory and file names without extras, then apply grep commands afterward.

M
Matzix
Member
56
05-02-2023, 05:03 PM
#14
Sure, it's meant to be a starting point and is available online. The goal was to create a challenging question that encourages students to engage in discussions together. I feel a bit conflicted about it.
M
Matzix
05-02-2023, 05:03 PM #14

Sure, it's meant to be a starting point and is available online. The goal was to create a challenging question that encourages students to engage in discussions together. I feel a bit conflicted about it.

Pages (2): Previous 1 2