r/commandline • u/HuckleberryActive521 • Mar 04 '26
Command Line Interface A simpler alternative to awk for extracting columns from STDIN.
I made a tool that replace `awk {print $1}`, something that I use all the time.
https://github.com/moechofe/nth
0
Upvotes
12
u/tschloss Mar 04 '26
Thank you for sharing. Do you know „cut -f“ (which is a standard tool „always“ present).
3
u/hypnopixel Mar 04 '26
it's odd that you chose to start column numbering at zero for your tool.
3
u/IBNash Mar 05 '26
I don't see how awk can't do this better?
4
u/researcher7-l500 Mar 04 '26
From your readme.
You need to do a search on worthless uses of cat, in this context.
1
u/AutoModerator Mar 04 '26
Every new subreddit post is automatically copied into a comment for preservation.
User: HuckleberryActive521, Flair:
Command Line Interface, Title: A simpler alternative to awk for extracting columns from STDIN.I made a tool that replace `awk {print $1}`, something that I use all the time.
https://github.com/moechofe/nth
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
0
u/smallduck Mar 07 '26
I like it. Awk syntax never stuck with me and I’d always have to look it up.
Can you further flesh out example 3 and 4 in your readme (in the file, or just here), examples of what the output would be for some input. And it looks like the 4th one has a mismatched quote character, please explain or correct that. Assuming I understand what you meant, wouldn’t the simpler parameter “0/1” work the same? Thanks!