Three completly different AWK programs:
seq 10 | awk '1 { print }'
seq 10 | awk '/1/ { print }'
seq 10 | awk 'NR==1 { print }'
Three completly different AWK programs:
seq 10 | awk '1 { print }'
seq 10 | awk '/1/ { print }'
seq 10 | awk 'NR==1 { print }'
In AWK an action without associated pattern defaults to 1.
So those two commands are the same:
seq 10 | awk '{print}'
seq 10 | awk '1 {print}'
Three completly different AWK programs:
seq 10 | awk '1 { print }'
seq 10 | awk '/1/ { print }'
seq 10 | awk 'NR==1 { print }'
@lnxw48a1 @bthall Glad you're enjoying the #Awk series. I'm currently planning episode 12. My collaborator's handle is b-yeezi (on #HPR anyway), but I don't believe he's on GS, Mastodon, or whatever
How to Write Complex Awk Patterns using Operators?
https://www.yesik.it/EP13
seq 10 | awk '{ print > "OUT." NR%2 }'
head OUT.?
Split a file in two parts based on odd/even lines
seq 10 | awk NR%2
Keep odd lines of a file
Converting a text to uppercase from the shell? Is that so simple? Yes, but...
https://www.yesik.it/EP17
You've probably noticed from my accent (pun intended), I'm a French native speaker. So, in this video I show you several classical ways to convert characters to upper case from the shell. And most important, I will explain how and why they work--or don't work--with characters outside the ASCII range.
#Uppercase #Lowercase
#Locale #AccentedLetters
#Sed #Awk #Bash
In #awk a pattern without associated action defaults to '{ print }'
seq 10 | awk /1/ is the same as
seq 10 | awk '/1/ {print}'
seq 10 | awk NR%2
Keep odd lines of a file
Jonkman Microblog is a social network, courtesy of SOBAC Microcomputer Services. It runs on GNU social, version 1.2.0-beta5, available under the GNU Affero General Public License.
All Jonkman Microblog content and data are available under the Creative Commons Attribution 3.0 license.