@robert42 @davidcarew may I recommend starting with something like:https://www.geeksforgeeks.org/linux-unix/awk-command-unixlinux-examples/

And eventually migrating to lists of raw examples like here: https://github.com/learnbyexample/learn_gnuawk/tree/master/code_snippets (the associated book is obviously helpful for context).

ymmv, good luck though!
#awk #sed #programming

AWK command in Linux - GeeksforGeeks

Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.

GeeksforGeeks
Would you like to sum the lengths of the given media files?
#sh #awk

@ojs yeah, I wondered whether "bash" meant "ksh" or "/bin/sh" or Actual Bash. For portable, there's also #awk 😁

@joel

@zimpenfish
I can recommend awk (or gawk = GNU awk) for such a task.

#awk

Curious which words (>3 letters) in your system dictionary have all the letters in alphabetical order? Sate your curiosity with a little #awk:

$ awk 'length>3 && /^a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*$/' /usr/share/dict/words

Optionally sort they by length:

$ awk 'length>3 && /^a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*$/{print length, $0}' /usr/share/dict/words | sort -n

give me "billowy" and "beefily" as words of interest. If you don't like duplicates, use "?" instead of "*"

$ awk 'length>3 && /^a?b?c?d?e?f?g?h?i?j?k?l?m?n?o?p?q?r?s?t?u?v?w?x?y?z?$/{print length, $0}' /usr/share/dict/words | sort -n

which gives "almost", "biopsy", and "chintz" as nice long runs.

터미널 μ‹€ν–‰μ‹œ 첫 화면을 μ»€μŠ€ν…€ν•΄λ³΄μž

WSL2 ν™˜κ²½μ—μ„œ C λ“œλΌμ΄λΈŒμ™€ 같은 μ£Όμš” λ””μŠ€ν¬μ˜ μ‚¬μš©λŸ‰μ„ 효율적으둜 κ΄€λ¦¬ν•˜κΈ° μœ„ν•΄ 터미널 접속 μ‹œλ§ˆλ‹€ μƒνƒœλ₯Ό μ‹œκ°ν™”ν•΄ λ³΄μ—¬μ£ΌλŠ” μžλ™ν™” λŒ€μ‹œλ³΄λ“œ ꡬ좕 과정을 λ‹€λ£Ήλ‹ˆλ‹€. λ¦¬λˆ…μŠ€μ˜ df λͺ…λ Ήμ–΄λ₯Ό awk 슀크립트둜 μ „μ²˜λ¦¬ν•˜μ—¬ 데이터λ₯Ό μΆ”μΆœν•˜κ³ , 이λ₯Ό κ²½λŸ‰ λ°μ΄ν„°λ² μ΄μŠ€μΈ SQLite에 μ €μž₯ν•˜μ—¬ 일별 μ‚¬μš©λŸ‰ 좔이λ₯Ό κΈ°λ‘ν•˜λŠ” 체계λ₯Ό λ§ˆλ ¨ν•©λ‹ˆλ‹€. 데이터 기둝을 μœ„ν•œ μ…Έ 슀크립트λ₯Ό μž‘μ„±ν•œ λ’€, μ €μž₯된 정보λ₯Ό λ°”νƒ•μœΌλ‘œ ν„°λ―Έλ„μ—μ„œ λ§‰λŒ€κ·Έλž˜ν”„ ν˜•νƒœμ˜ λ°” ν”Œλ‘―(bar plot)을 좜λ ₯ν•˜λŠ” λŒ€μ‹œλ³΄λ“œ κΈ°λŠ₯을 κ΅¬ν˜„ν•©λ‹ˆλ‹€. λ§ˆμ§€λ§‰μœΌλ‘œ ~/.bashrc 섀정을 톡해 터미널을 μ—΄ λ•Œλ§ˆλ‹€ μžλ™μœΌλ‘œ μ΅œμ‹  λ””μŠ€ν¬ μƒνƒœλ₯Ό κΈ°λ‘ν•˜κ³  확인할 수 μžˆλ„λ‘ μžλ™ν™”ν•¨μœΌλ‘œμ¨, λΆˆν•„μš”ν•œ 파일 정리 μ‹œμ μ„ μ§κ΄€μ μœΌλ‘œ νŒŒμ•…ν•˜κ³  μ‹œμŠ€ν…œ μžμ›μ„ 효율적으둜 관리할 수 μžˆλŠ” ν™˜κ²½μ„ μ œκ³΅ν•©λ‹ˆλ‹€.

Hackers' Pub

RE: https://genart.social/@davidcarew/116178444886600923

I absolutely agree with @davidcarew about usefulness of #sed and #awk.

I am starting to dabble with #xsltproc for some #XML aware bulk modification.

I used #XSLT to convert an XML file into #wget commands to download additional XML files I needed for a project. (First file listed the base name of additional files, each in an element / node.)

It's amazing how satisfying and powerful it feels to know even a little #sed and #awk. They are just great tools
New post: "Genres, cuids and a bit of AWK
" - Using AWK to process the Genres data from the CAP bookshop sample πŸ‘‰ #AWK #SAPCAP https://qmacro.org/blog/posts/2026/03/03/genres-cuids-and-a-bit-of-awk/

New AWKzine Issue (#2) is posted. It's a Hexdump clone implemented in #gawk (#awk).
https://maplefish.com/todd/hexdump.html

(issues: https://maplefish.com/todd)

Hexdump (AWKzine Issue #2)