You are not logged in.

#1 2005-05-13 22:58:02

Meshuggin
Member
From: /home/meshuggin
Registered: 2005-03-23
Posts: 137

Some data in torsmo

Hi, I'm trying to make a script to show in torsmo:

- Amount of Packages on my system
- My CPU Model
- Amount of modules loaded

And I got it work correctly, but there's one little detail, I need to delete some spaces when I am editing the result of ...for example /proc/cpuinfo , how can I do that?, something related to sed?

Thanxs


Arch GNU/Linux 0.7.1 (Noodle)
Linux 2.6.14-archck1

Offline

#2 2005-05-13 23:05:44

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Some data in torsmo

seems I've been doing alot of regex explainations today... (someone at work asked me "hey what's this 'pattern' variable for".... sigh... do they even interview these monkeys?)

as for using sed, you want to do it like this:

 sed "s/<anything before>(<pattern to match>)<anything after>/1/g"

that will replace any line with whatever was in the "(" and ")" grouping....
so... lets say we have a line like:
"    I have spaces before and after               "
if we pipe this line to sed, we can do:

sed "s/s*(.*)s*/1/g"

wow, that looks complicated 8)

you can also use "tr" to remove characters from the output....

how about this: post your output and what you want it to look like, and I'll give you a sed expression to make it work 8)

Offline

#3 2005-05-14 00:40:16

tbroderick
Member
Registered: 2005-05-06
Posts: 45

Re: Some data in torsmo

${execi 5 cat /proc/cpuinfo | grep "model name" | sed s/'model name.*:'//}

Offline

#4 2005-05-14 02:22:20

Meshuggin
Member
From: /home/meshuggin
Registered: 2005-03-23
Posts: 137

Re: Some data in torsmo

Thanks, phrakture ...

sed "s/s*(.*)s*/1/g"

it works fine wink,

Also thanks for your post tbroderick


Arch GNU/Linux 0.7.1 (Noodle)
Linux 2.6.14-archck1

Offline

Board footer

Powered by FluxBB