Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
lucb1e
9mo ago
0 comments
Share
Or sticking with awk, I have this bash alias to remove excess whitespace that is just:
awk '{$1=$1};1'
0 comments
default
newest
oldest
fuzztester
9mo ago
what does the 1 at the end do? make awk print all lines? I'm a bit rusty with my awk.
thrwwy9234
9mo ago
It’s a condition. 1 is true-ish, so it’s a condition that is always true. The default action in awk is print, so it’s the same as:
'{$1=$1}1{print}'
Or the same as
'{$1=$1}{print}'
Since the default condition is true. But 1 is shorter than {print}.
j
/
k
navigate · click thread line to collapse