Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

awk raws without spaces and tabulators at the beginings

Status
Not open for further replies.

maciekzklanu

Programmer
Dec 9, 2013
1
0
0
I have to write a AWK program, which write all raws without tabulators and spaces at the beginings of the raws.
here i have my inputs

1 -2 3 -5 2
0 10 -12 -2 3 1
and my outputs:

1 -2 3 -5 2
0 10 -12 -2 3 1


i don't know how to do that..!! please help!!
 
So, you simply want to strip the leading spaces ?
A simple sed command will do it, but as we are in the awk forum:
Code:
awk '{sub(/^[ \t]*/,"");print}' /path/to/input >output

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top