Computing.Net > Forums > Programming > concatenate variable to set length

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

concatenate variable to set length

Reply to Message Icon

Name: fp56
Date: February 8, 2008 at 07:06:25 Pacific
OS: Windows XP Pro
CPU/Ram: P4 2Gb ram
Product: HP
Comment:

I receive files containing vaiable length records on a daily basis which need to be reformatted to a specific length. Is there a way to concatenate these files to a set length? I currently run two different utilities to accomplish this.


Frank



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: February 8, 2008 at 08:38:51 Pacific
Reply:

When you say concatenate, do you mean truncate? You may find with a suitable utility like Awk, Perl or Python, you can write a short script to do just that.


0

Response Number 2
Name: Mechanix2Go
Date: February 9, 2008 at 05:16:17 Pacific
Reply:

To use the first 10 chars, for instance:

::==
@echo off
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in (myfile) do (
set str=%%a
set str=!str:~0,10!
echo !str!
)



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 3
Name: User123456789
Date: February 11, 2008 at 01:50:36 Pacific
Reply:

As Mechanix states, the SET command has got many useful features

set /?

Hi there.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: concatenate variable to set length

How to set java classpath in vista www.computing.net/answers/programming/how-to-set-java-classpath-in-vista/15739.html

how to set error control in this? www.computing.net/answers/programming/how-to-set-error-control-in-this/16841.html

How to Set Clock Back 5 minutes in Dos? www.computing.net/answers/programming/how-to-set-clock-back-5-minutes-in-dos/19976.html