Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 577
  • Last Modified:

Simple Awk

Simple AWK --- I have this in a file     Apr 02   and I want this Apr 2    I want to replace the only the leading 0 with a blank, I have tried using awk sub, (0,,file) and awk substr ($2,0,1) but I can not get the blank to work. Can I just delete the leading 0? Brain dead need help. thanks  

0
petro2
Asked:
petro2
  • 2
1 Solution
 
ozoCommented:
awk 'gsub(/ 0+/," ")'
0
 
ozoCommented:
awk '{gsub(/ 0+/," ");print}'
0
 
ahoffmannCommented:
keep in mind that gsub is nawk, gawk

awk '{printf"%s %d",$1,$2}'
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now