[mesa-users] how to extract columns from existing log file

Michael Zingale michael.zingale at stonybrook.edu
Mon Oct 20 13:49:12 EDT 2014


I think on most systems these days, awk is just a link to gawk.  E.g, on
Fedora:

ls -l /usr/bin/awk
lrwxrwxrwx. 1 root root 4 Aug  1 15:06 /usr/bin/awk -> gawk

I always use awk for this sort of thing as well.



On Mon, Oct 20, 2014 at 1:42 PM, Aaron Dotter <aaron.dotter at gmail.com>
wrote:

> Hi Bill,
>
> I was just about to recommend gawk but Rob sorta beat me to it.  It's like
> awk but traditional awk might choke on 100s of MBs of data.  gawk should
> not.
>
> Otherwise it works just like awk in Rob's email.
>
> Aaron
>
> On Mon, Oct 20, 2014 at 1:39 PM, Robert FARMER <rjfarmer at asu.edu> wrote:
>
>> If you know the column numbers you could do:
>>
>> awk '{print $NUM1,$NUM2...}' file
>>
>> where $NUM1 is column numbers,
>> $0 is the whole line
>> $1 first column etc
>>
>> If you want to skip the header then you can do this:
>> awk '{if(NR>2) print $1,$2...}' file
>>
>> Where NR tracks the number of rows
>>
>> Rob
>>
>>
>>
>> On Mon, Oct 20, 2014 at 10:35 AM, Bill Paxton <paxton at kitp.ucsb.edu>
>> wrote:
>>
>>> Some unix wizard out there will have a solution for this one I'm sure.
>>>
>>> I have a monster history.data file (100s of MB) with lots and lots of
>>> columns, most of which are unneeded for my current task --
>>> it would be lovely to have a simple way to extract a small subset of the
>>> columns to create a much smaller history.data file.
>>> ideally, i'd give this marvelous tool a file with a list of the column
>>> names that i want and it would do the rest.
>>>
>>> and of course i don't want to have to do any work to create this tool
>>> for myself.  i want Santa Claus to give it to me.  now.  ;D
>>>
>>> Thanks,
>>> Bill
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Comprehensive Server Monitoring with Site24x7.
>>> Monitor 10 servers for $9/Month.
>>> Get alerted through email, SMS, voice calls or mobile push notifications.
>>> Take corrective actions from your mobile device.
>>> http://p.sf.net/sfu/Zoho
>>> _______________________________________________
>>> mesa-users mailing list
>>> mesa-users at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/mesa-users
>>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Comprehensive Server Monitoring with Site24x7.
>> Monitor 10 servers for $9/Month.
>> Get alerted through email, SMS, voice calls or mobile push notifications.
>> Take corrective actions from your mobile device.
>> http://p.sf.net/sfu/Zoho
>> _______________________________________________
>> mesa-users mailing list
>> mesa-users at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mesa-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
> http://p.sf.net/sfu/Zoho
> _______________________________________________
> mesa-users mailing list
> mesa-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mesa-users
>
>


-- 
Michael Zingale
Associate Professor

Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY
11794-3800
*phone*:  631-632-8225
*e-mail*: Michael.Zingale at stonybrook.edu
*web*: http://www.astro.sunysb.edu/mzingale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20141020/43f2801b/attachment.html>


More information about the Mesa-users mailing list