Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 712829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:53:32+00:00 2026-05-14T04:53:32+00:00

Every month, 4 or 5 text files are created. The data in the files

  • 0

Every month, 4 or 5 text files are created. The data in the files is pulled into MS Access and used in a mailmerge.

Each file contains a header. This is an example:
HEADER|0000000130|0000527350|0000171250|0000058000|0000756600|0000814753|0000819455|100106

The 2nd field is the number of records contained in the file (excluding the header line). The last field is the date in the form yymmdd.

Using gawk (for Windows), I’ve done ok with rearranging/modifying the data and writing it all out to a new file for importing into Access except for the following.

I’m trying to create a unique ID number for each record. The ID number has the form 1mmddyyXXXX, where XXXX is a number, padded with leading zeros. Using the header above, the first record in the output file would get the ID number 10106100001 and the last record would get the ID 10106100130.

I’ve tried putting the second field in the header into a variable, rearranging the last header field into the required date format and then looping with “for” statements to append the XXXX part of the ID and then outputting it all with printf but so far I’ve been complete rubbish at it.

Thanks for your help!
gary

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:53:32+00:00Added an answer on May 14, 2026 at 4:53 am

    Invoke awk(1) with the option “-F |” and use the following statement to set the identifier:
    id=sprintf(“1%02d%02d%02d%04d”, substr($9,3,2), substr($9,5,2), substr($9,1,2), NR)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text file which contains: Cycle code Cycle month Cycle year Event
I have about 500GB of text file seperated in months. In these text files
I want to write some stats to a text file every time a person
I want to return a row for every month in a range specified- what
I have deployed my app and it's in use. Every month or so I
One error I stumble upon every few month is this one: double x =
Every tick of timer I'd like to check the received data: 000000000 and if
Every time I change a file in a web project in Visual Studio (.js,
Exists such db schema: alt text http://img156.imageshack.us/img156/9017/2706.png I need to write query. For every
I have an InstallShield (InstallScript) installation, created using IS2009, that's built automatically every night,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.