Rich Freeman via plug on 10 Sep 2020 09:11:02 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Awk *language*: was Win Subsystem for Linux2 broken


On Thu, Sep 10, 2020 at 12:01 PM Walt Mankowski via plug
<plug@lists.phillylinux.org> wrote:
>
> I used to still use awk for splitting files since the syntax was a bit
> simpler than Perl, but cut(1) does the simple cases even more simply,
> and for anything else I use `perl -a`.

Main thing I do with awk is use it to pull one field out of a record.

Stuff like:
zfs list -t snapshot -r offline1/storage | awk '{ print $1}' | tail -n
+2 | xargs -n 1 zfs destroy

This pulls up a list of snapshots, grabs just the first field of each,
strips the headers, then deletes each one.

Is there an easier way to pull one field (not necessarily the first)
out of a list?

-- 
Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug