On 15.09.2012 17:01, Chris F.A. Johnson wrote:
> On 2012-09-15, Mirko K. wrote:
>> On 15.09.2012 09:38, Chris F.A. Johnson wrote:
>>> On 2012-09-15, Kaz Kylheku wrote:
>>>> On 2012-09-15, Beery <
mento...@gmail.com> wrote:
>>>>> I have a file containing rows like
>>>>>
>>>>> MemTotal: 32959876 kB\nMemFree: 309820 kB\nBuffers: 563784 kB...
>>>>
>>>> LOL! See the "Simple Query" here:
>>>>
>>>>
http://rosettacode.org/wiki/Category:TXR
>>>
>>> What? Yet another unnecessary language?
>>>
>>>> Note that that code will work even if the fields of /proc/meminfo are
>>>> reordered, and interspersed with fields that you don't need.
>>>
>>> What does /proc/meminfo have to do with the question?
>>
>> $ head -3 /proc/meminfo
>> MemTotal: 3096544 kB
>> MemFree: 659352 kB
>> Buffers: 413220 kB
>
> Which is not what the OP asked about. The string is question has literal
> backslash,n pairs, not newlines:
Yes, but the OP's data is most probably extracted from
/proc/meminfo. And that's what /proc/meminfo has to do with it.
Nothing more, nothing less.
> MemTotal: 32959876 kB\nMemFree: 309820 kB\nBuffers: 563784 kB...
It's well possible, that the OP is generating the data in a wrong
(or just different than needed) way, like:
$ python -c 'm=open("/proc/meminfo").read();print repr(m)'
'MemTotal: 3096544 kB\nMemFree: 221028 kB\nBuffers:
366880 kB ...