  Removing Spaces from File Records? 
 The Question is:
 
How do I convert a fixed length file that is padded with spaces to a variable
 length file with the trailing spaces removed?
 
 The Answer is :
In perl the solution would be:
 
perl -e "while (&lt;&gt;) { s/\s+$/\n/; print }" &lt; input-file &gt; 
 
Using DCL it could look like:
 
@trim input-file trimmed-file
 
where trim.com contains:
 
$if p2.eqs."" then exit
$open/read input 'p1
$crea 'p2
$open/appen output 'p2
$record_loop:
$ read/end=done input record
$ l = f$len(record)
$space_loop:
$ l = l - 1
$ if f$extract(l,1,record).eqs." " then goto space_loop
$ write output f$extract(0,l+1,record)
$ goto record_loop
$done:
$ close input
$ close output
$ exit
 
 Answer written or last revised on  6-JAN-2004 
