Solved

Simple Awk

Posted on 2004-04-02
3
557 Views
Last Modified: 2010-04-21
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
Comment
Question by:petro2
  • 2
3 Comments
 
LVL 84

Expert Comment

by:ozo
Comment Utility
awk 'gsub(/ 0+/," ")'
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
awk '{gsub(/ 0+/," ");print}'
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 250 total points
Comment Utility
keep in mind that gsub is nawk, gawk

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

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now