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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF STATMENT

Status
Not open for further replies.

kamsabeti

IS-IT--Management
Feb 26, 2008
21
How can I use the IF statment for the this code:

npt = substr($0,24,12)

IF npt <> "" THEN DO THIS ELSE npt = "0"
{ # Insert "-" after each group of 5 chars.
gsub( /...../, "&-", npt )
# Remove any trailing "-".
sub( /- *$/, "", npt )
}
 
Code:
 if (npt != "") {
  # Insert "-" after each group of 5 chars.
  gsub( /...../, "&-", npt )
  # Remove any trailing "-".
  sub( /- *$/, "", npt )
} else {
  npt = 0
}

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top