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

removing padding spaces from a DB 1

Status
Not open for further replies.

arcticpuppy

Technical User
Jan 14, 2003
8
US
I am reading a database that has triling blanks in the data so when I do a length($0) and use this to define the substr($0,4,length($0)- 4) I want to use. The data contains text and thus removing spaces from the end using a gsub may be tricky

This shows up bigtime when I try to append two lines of data together and I get huge spaces

Any ideas ?

 
Could you post a couple of lines for us to look at?
 
Example code
as requested



AB Wrestling promoters Jonesy (Abbott) and Max (Costello) trail their
runaway fighter to Algiers where they're tricked into joining the
French Foreign Legion. They have to cope with a sadistic sergeant and
a sexy spy (Medina) to find their man. Most of the laughs come from
Lou's wild desert mirages. The no-frills DVD reflects the spirit of
this long-running but low-budget Universal series. As was almost
always the case, the black-and-white photography is crisp and the
familiar sets are well used. The only obvious visual flaw is some
wild flashing on Lou's tie.
 
# ------------------------------------------------------------------------
#
# Function to "trim" leading and trailing spaces from a
# string NOT disturbing the "embedded" spaces.
#
function trim(str)
{
nsub1=sub("^[ ]*", "", str);
nsub2=sub("[ ]*$", "", str);
return str;
}
vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top