New here; got a command line problem

JohnB

New Member
Joined
Apr 1, 2020
Messages
3
Reaction score
1
Credits
0
Hi there,

I'm currently a student at my local university doing an IT degree (just started the final year of my coursework), and I have elected to do some UNIX subjects just so I can better understand my future role etc. I think I have a general grasp of the CLI although I'm still a beginner, and I have a task to capture the 'flag' settings of my cpu information and output them sequentially line by line in an alphabetical list (number first like 3dprefetchnow). What's more; I have to do this in a single command, so I can't use ; to separate them. This is a problem that I've been trying to tackle off and on for about 3 days now, and I can't seem to make much more headway than I have. Navigating to the /proc directory I type:

cat cpuinfo | grep "flags" | cut -d ":" -f 2 | <<<????>>>

This shows the list of flags set by the cpu (interestingly enough; I think it actually has a preceding whitespace character in the output, but I'm not sure if this is something I should be completely concerned with) but I can't use sort as my next command because from all the examples I've seen of it; sort works on a line by line basis, not by words in a single line.

My question is, what next? I had seq suggested (with the global flag) but honestly I'm not quite sure how that would work given that it's a find and replace method right? How would that do a recursive alphabet lookup?
 


sound like an aussie (ask me how)

g'day john and welcome to linux.org :)

you're in the right spot, we have some cli gurus, but they range from uk to usa, so allow for timezones, and one will likely be along

cheers mate

chris turner
wizardfromoz
 
and good luck with the course, hope you don't need it
 
I am indeed an aussie. Other than timezone posting, was there something I said that gave it away?

Oh; was it because I said 'university' instead of say; college?
 
when you get your answer here, and you have time, swing over to member introductions and tell us a little of the johnb story and meet some of the gang - i'll answer you there, to save dragging us off-topic here

wiz :)
 
I managed to solve it. I meant sed not seq.

cat cpuinfo | grep "flags | cut -d ":" -f 2 | sed 's+ +\n/g' | sort
 

Staff online


Top