I've never needed shuf, and awk is a bit out of place in the list, but head and tail have saved me from many a large file. The interesting data is usually in head, tail, or grep anyway.
I've never needed shuf, and awk is a bit out of place in the list, but head and tail have saved me from many a large file. The interesting data is usually in head, tail, or grep anyway.
awk 'BEGIN{FS=":"; OFS=":"} {print $1,$NF}' /etc/password
Works on CSV files too with the right field separator.
Yeah also cut is just inconvenient, awk works much better when working with the usual tabulated data.
> Works on CSV files too with the right field separator.
You're probably better off using xsv though.
And I'm not even sure what the second one is trying to do. Print the user name, followed by the number of fields separated by colons? What good is that? Perhaps you've forgotten that not everyone can read awk syntax right off the page.
[0] https://manpages.debian.org/stretch/original-awk/awk.1.en.ht... [1] https://www.unix.com/man-page/plan9/1/AWK/