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

Help with opening a dat file and trim characters if necessary.

Status
Not open for further replies.

tamer64

IS-IT--Management
Aug 27, 2007
120
US
Hello,

I need help with writing a script that will open a dat file in my temp directory and then check a specific column's field "USER_ID". if the column USER_ID field is more than 6 characters I would then need the script to trim from the RIGHT of the "USER_ID' column to be within the 6 character limit. If the column is within the 6 Character limit, I need the script to do nothing. Additionally, the filename of the file in my temp file is never the same name so I would need the script to just look for and read from the .dat file.



"c:\Temp\sattransfers012014.dat"

"RECORDID"!"DATE"!"Status"!"USER_ID"!"LOCATION"
"34565"!"20140917"!"Online"!"cranberrydo"!"SANDIEGO"
"42344"!"20140912"!"Online"!"cranberrydo"!"SANDIEGO"
"34344"!"20140514"!"Online"!"cranberrydo"!"SANDIEGO"

"RECORDID"!"DATE"!"Status"!"USER_ID"!"LOCATION"
"34565"!"20140917"!"Online"!"cranbe"!"SANDIEGO"
"42344"!"20140912"!"Online"!"cranbe"!"SANDIEGO"
"34344"!"20140514"!"Online"!"cranbe"!"SANDIEGO"

Any assistance is greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top