Comment on Parsing JSON in Forty Lines of AwkparentComments−fragmede1yif you do: sed 's/ / /g'−lucb1e1yOr sticking with awk, I have this bash alias to remove excess whitespace that is just: awk '{$1=$1};1'−fuzztester1ywhat does the 1 at the end do? make awk print all lines? I'm a bit rusty with my awk.−thrwwy92341yIt’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}.
Comments
if you do:
Or sticking with awk, I have this bash alias to remove excess whitespace that is just:
what does the 1 at the end do? make awk print all lines? I'm a bit rusty with my awk.
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:
Or the same as Since the default condition is true. But 1 is shorter than {print}.